當前位置: 首頁>>代碼示例>>Java>>正文


Java JsonAutoDetect.Visibility方法代碼示例

本文整理匯總了Java中com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility方法的典型用法代碼示例。如果您正苦於以下問題:Java JsonAutoDetect.Visibility方法的具體用法?Java JsonAutoDetect.Visibility怎麽用?Java JsonAutoDetect.Visibility使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.fasterxml.jackson.annotation.JsonAutoDetect的用法示例。


在下文中一共展示了JsonAutoDetect.Visibility方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getVisibility

import com.fasterxml.jackson.annotation.JsonAutoDetect; //導入方法依賴的package包/類
private Visibility getVisibility(JsonAutoDetect.Visibility visibility, Visibility defaultVisibility) {
    switch (visibility) {
        case DEFAULT:
            return defaultVisibility;
        case ANY:
            return Visibility.ANY;
        case NON_PRIVATE:
            return Visibility.NON_PRIVATE;
        case NONE:
            return Visibility.NONE;
        case PROTECTED_AND_PUBLIC:
            return Visibility.PROTECTED_AND_PUBLIC;
        case PUBLIC_ONLY:
            return Visibility.PUBLIC_ONLY;
    }
    throw new AssertionError("Unsupported visibility:" + visibility);
}
 
開發者ID:konsoletyper,項目名稱:teavm-flavour,代碼行數:18,代碼來源:ClassInformationProvider.java

示例2: Std

import com.fasterxml.jackson.annotation.JsonAutoDetect; //導入方法依賴的package包/類
public Std(JsonAutoDetect.Visibility paramVisibility)
{
  if (paramVisibility == JsonAutoDetect.Visibility.DEFAULT)
  {
    this._getterMinLevel = DEFAULT._getterMinLevel;
    this._isGetterMinLevel = DEFAULT._isGetterMinLevel;
    this._setterMinLevel = DEFAULT._setterMinLevel;
    this._creatorMinLevel = DEFAULT._creatorMinLevel;
    this._fieldMinLevel = DEFAULT._fieldMinLevel;
    return;
  }
  this._getterMinLevel = paramVisibility;
  this._isGetterMinLevel = paramVisibility;
  this._setterMinLevel = paramVisibility;
  this._creatorMinLevel = paramVisibility;
  this._fieldMinLevel = paramVisibility;
}
 
開發者ID:mmmsplay10,項目名稱:QuizUpWinner,代碼行數:18,代碼來源:VisibilityChecker.java

示例3: withVisibility

import com.fasterxml.jackson.annotation.JsonAutoDetect; //導入方法依賴的package包/類
public Std withVisibility(PropertyAccessor paramPropertyAccessor, JsonAutoDetect.Visibility paramVisibility)
{
  switch (VisibilityChecker.1.$SwitchMap$com$fasterxml$jackson$annotation$PropertyAccessor[paramPropertyAccessor.ordinal()])
  {
  default:
    return this;
  case 1:
    return withGetterVisibility(paramVisibility);
  case 2:
    return withSetterVisibility(paramVisibility);
  case 3:
    return withCreatorVisibility(paramVisibility);
  case 4:
    return withFieldVisibility(paramVisibility);
  case 5:
    return withIsGetterVisibility(paramVisibility);
  case 6:
  }
  return with(paramVisibility);
}
 
開發者ID:mmmsplay10,項目名稱:QuizUpWinner,代碼行數:21,代碼來源:VisibilityChecker.java

示例4: fromJson

import com.fasterxml.jackson.annotation.JsonAutoDetect; //導入方法依賴的package包/類
public static <T> T fromJson(String json, Class<T> entityClass, JsonAutoDetect.Visibility visibility)
{
    T instance = null;

    // Need to make this local to be thread safe
    ObjectMapper localMapper = new ObjectMapper();
    localMapper.setVisibility(PropertyAccessor.FIELD, visibility);

    try
    {
        instance = localMapper.readValue(json, entityClass);
    } catch (IOException e)
    {
        e.printStackTrace();
    }

    return instance;
}
 
開發者ID:SMARTRACTECHNOLOGY-PUBLIC,項目名稱:smartcosmos-sdk-java,代碼行數:19,代碼來源:JsonUtil.java

示例5: toJson

import com.fasterxml.jackson.annotation.JsonAutoDetect; //導入方法依賴的package包/類
public static String toJson(Object object, JsonAutoDetect.Visibility visibility)
{
    String json = null;

    // Need to make this local to be thread safe
    ObjectMapper localMapper = new ObjectMapper();
    localMapper.setVisibility(PropertyAccessor.FIELD, visibility);

    try
    {
        json = localMapper.writeValueAsString(object);
    } catch (JsonProcessingException e)
    {
        if (LOG.isDebugEnabled())
        {
            e.printStackTrace();
        }
        LOG.error("Unable to convert object to JSON: {}", e.getMessage());
    }
    return json;
}
 
開發者ID:SMARTRACTECHNOLOGY-PUBLIC,項目名稱:smartcosmos-sdk-java,代碼行數:22,代碼來源:JsonUtil.java

示例6: isSetterAutoDetected

import com.fasterxml.jackson.annotation.JsonAutoDetect; //導入方法依賴的package包/類
private static boolean isSetterAutoDetected( RebindConfiguration configuration, PropertyAccessors propertyAccessors, BeanInfo info ) {
    if ( !propertyAccessors.getSetter().isPresent() ) {
        return false;
    }

    for ( Class<? extends Annotation> annotation : AUTO_DISCOVERY_ANNOTATIONS ) {
        if ( propertyAccessors.isAnnotationPresentOnSetter( annotation ) ) {
            return true;
        }
    }

    JMethod setter = propertyAccessors.getSetter().get();

    String methodName = setter.getName();
    if ( !methodName.startsWith( "set" ) || methodName.length() <= 3 ) {
        // no annotation on method and the method does not follow naming convention
        return false;
    }

    JsonAutoDetect.Visibility visibility = info.getSetterVisibility();
    if ( Visibility.DEFAULT == visibility ) {
        visibility = configuration.getDefaultSetterVisibility();
    }
    return isAutoDetected( visibility, setter.isPrivate(), setter.isProtected(), setter.isPublic(), setter
            .isDefaultAccess() );
}
 
開發者ID:nmorel,項目名稱:gwt-jackson,代碼行數:27,代碼來源:PropertyProcessor.java

示例7: isFieldAutoDetected

import com.fasterxml.jackson.annotation.JsonAutoDetect; //導入方法依賴的package包/類
private static boolean isFieldAutoDetected( RebindConfiguration configuration, PropertyAccessors propertyAccessors, BeanInfo info ) {
    if ( !propertyAccessors.getField().isPresent() ) {
        return false;
    }

    for ( Class<? extends Annotation> annotation : AUTO_DISCOVERY_ANNOTATIONS ) {
        if ( propertyAccessors.isAnnotationPresentOnField( annotation ) ) {
            return true;
        }
    }

    JField field = propertyAccessors.getField().get();

    JsonAutoDetect.Visibility visibility = info.getFieldVisibility();
    if ( Visibility.DEFAULT == visibility ) {
        visibility = configuration.getDefaultFieldVisibility();
    }
    return isAutoDetected( visibility, field.isPrivate(), field.isProtected(), field.isPublic(), field
            .isDefaultAccess() );
}
 
開發者ID:nmorel,項目名稱:gwt-jackson,代碼行數:21,代碼來源:PropertyProcessor.java

示例8: isAutoDetected

import com.fasterxml.jackson.annotation.JsonAutoDetect; //導入方法依賴的package包/類
private static boolean isAutoDetected( JsonAutoDetect.Visibility visibility, boolean isPrivate, boolean isProtected, boolean
        isPublic, boolean isDefaultAccess ) {
    switch ( visibility ) {
        case ANY:
            return true;
        case NONE:
            return false;
        case NON_PRIVATE:
            return !isPrivate;
        case PROTECTED_AND_PUBLIC:
            return isProtected || isPublic;
        case PUBLIC_ONLY:
        case DEFAULT:
            return isPublic;
        default:
            return false;
    }
}
 
開發者ID:nmorel,項目名稱:gwt-jackson,代碼行數:19,代碼來源:PropertyProcessor.java

示例9: withCreatorVisibility

import com.fasterxml.jackson.annotation.JsonAutoDetect; //導入方法依賴的package包/類
public Std withCreatorVisibility(JsonAutoDetect.Visibility paramVisibility)
{
  if (paramVisibility == JsonAutoDetect.Visibility.DEFAULT)
    paramVisibility = DEFAULT._creatorMinLevel;
  if (this._creatorMinLevel == paramVisibility)
    return this;
  JsonAutoDetect.Visibility localVisibility1 = this._getterMinLevel;
  JsonAutoDetect.Visibility localVisibility2 = this._isGetterMinLevel;
  JsonAutoDetect.Visibility localVisibility3 = this._setterMinLevel;
  JsonAutoDetect.Visibility localVisibility4 = this._fieldMinLevel;
  return new Std(localVisibility1, localVisibility2, localVisibility3, paramVisibility, localVisibility4);
}
 
開發者ID:mmmsplay10,項目名稱:QuizUpWinner,代碼行數:13,代碼來源:VisibilityChecker.java

示例10: withFieldVisibility

import com.fasterxml.jackson.annotation.JsonAutoDetect; //導入方法依賴的package包/類
public Std withFieldVisibility(JsonAutoDetect.Visibility paramVisibility)
{
  if (paramVisibility == JsonAutoDetect.Visibility.DEFAULT)
    paramVisibility = DEFAULT._fieldMinLevel;
  if (this._fieldMinLevel == paramVisibility)
    return this;
  return new Std(this._getterMinLevel, this._isGetterMinLevel, this._setterMinLevel, this._creatorMinLevel, paramVisibility);
}
 
開發者ID:mmmsplay10,項目名稱:QuizUpWinner,代碼行數:9,代碼來源:VisibilityChecker.java

示例11: withGetterVisibility

import com.fasterxml.jackson.annotation.JsonAutoDetect; //導入方法依賴的package包/類
public Std withGetterVisibility(JsonAutoDetect.Visibility paramVisibility)
{
  if (paramVisibility == JsonAutoDetect.Visibility.DEFAULT)
    paramVisibility = DEFAULT._getterMinLevel;
  if (this._getterMinLevel == paramVisibility)
    return this;
  JsonAutoDetect.Visibility localVisibility1 = this._isGetterMinLevel;
  JsonAutoDetect.Visibility localVisibility2 = this._setterMinLevel;
  JsonAutoDetect.Visibility localVisibility3 = this._creatorMinLevel;
  JsonAutoDetect.Visibility localVisibility4 = this._fieldMinLevel;
  return new Std(paramVisibility, localVisibility1, localVisibility2, localVisibility3, localVisibility4);
}
 
開發者ID:mmmsplay10,項目名稱:QuizUpWinner,代碼行數:13,代碼來源:VisibilityChecker.java

示例12: withIsGetterVisibility

import com.fasterxml.jackson.annotation.JsonAutoDetect; //導入方法依賴的package包/類
public Std withIsGetterVisibility(JsonAutoDetect.Visibility paramVisibility)
{
  if (paramVisibility == JsonAutoDetect.Visibility.DEFAULT)
    paramVisibility = DEFAULT._isGetterMinLevel;
  if (this._isGetterMinLevel == paramVisibility)
    return this;
  JsonAutoDetect.Visibility localVisibility1 = this._getterMinLevel;
  JsonAutoDetect.Visibility localVisibility2 = this._setterMinLevel;
  JsonAutoDetect.Visibility localVisibility3 = this._creatorMinLevel;
  JsonAutoDetect.Visibility localVisibility4 = this._fieldMinLevel;
  return new Std(localVisibility1, paramVisibility, localVisibility2, localVisibility3, localVisibility4);
}
 
開發者ID:mmmsplay10,項目名稱:QuizUpWinner,代碼行數:13,代碼來源:VisibilityChecker.java

示例13: withSetterVisibility

import com.fasterxml.jackson.annotation.JsonAutoDetect; //導入方法依賴的package包/類
public Std withSetterVisibility(JsonAutoDetect.Visibility paramVisibility)
{
  if (paramVisibility == JsonAutoDetect.Visibility.DEFAULT)
    paramVisibility = DEFAULT._setterMinLevel;
  if (this._setterMinLevel == paramVisibility)
    return this;
  JsonAutoDetect.Visibility localVisibility1 = this._getterMinLevel;
  JsonAutoDetect.Visibility localVisibility2 = this._isGetterMinLevel;
  JsonAutoDetect.Visibility localVisibility3 = this._creatorMinLevel;
  JsonAutoDetect.Visibility localVisibility4 = this._fieldMinLevel;
  return new Std(localVisibility1, localVisibility2, paramVisibility, localVisibility3, localVisibility4);
}
 
開發者ID:mmmsplay10,項目名稱:QuizUpWinner,代碼行數:13,代碼來源:VisibilityChecker.java

示例14: isGetterAutoDetected

import com.fasterxml.jackson.annotation.JsonAutoDetect; //導入方法依賴的package包/類
private static boolean isGetterAutoDetected( RebindConfiguration configuration, PropertyAccessors propertyAccessors, BeanInfo info ) {
    if ( !propertyAccessors.getGetter().isPresent() ) {
        return false;
    }

    for ( Class<? extends Annotation> annotation : AUTO_DISCOVERY_ANNOTATIONS ) {
        if ( propertyAccessors.isAnnotationPresentOnGetter( annotation ) ) {
            return true;
        }
    }

    JMethod getter = propertyAccessors.getGetter().get();

    String methodName = getter.getName();
    JsonAutoDetect.Visibility visibility;
    if ( methodName.startsWith( "is" ) && methodName.length() > 2 && JPrimitiveType.BOOLEAN.equals( getter.getReturnType()
            .isPrimitive() ) ) {

        // getter method for a boolean
        visibility = info.getIsGetterVisibility();
        if ( Visibility.DEFAULT == visibility ) {
            visibility = configuration.getDefaultIsGetterVisibility();
        }

    } else if ( methodName.startsWith( "get" ) && methodName.length() > 3 ) {

        visibility = info.getGetterVisibility();
        if ( Visibility.DEFAULT == visibility ) {
            visibility = configuration.getDefaultGetterVisibility();
        }

    } else {
        // no annotation on method and the method does not follow naming convention
        return false;
    }
    return isAutoDetected( visibility, getter.isPrivate(), getter.isProtected(), getter.isPublic(), getter.isDefaultAccess() );
}
 
開發者ID:nmorel,項目名稱:gwt-jackson,代碼行數:38,代碼來源:PropertyProcessor.java

示例15: withVisibility

import com.fasterxml.jackson.annotation.JsonAutoDetect; //導入方法依賴的package包/類
public BaseSettings withVisibility(PropertyAccessor forMethod, JsonAutoDetect.Visibility visibility) {
    return new BaseSettings(_classIntrospector, _annotationIntrospector,
            _visibilityChecker.withVisibility(forMethod, visibility),
            _propertyNamingStrategy, _typeFactory,
            _typeResolverBuilder, _dateFormat, _handlerInstantiator, _locale,
            _timeZone, _defaultBase64);
}
 
開發者ID:joyplus,項目名稱:joyplus-tv,代碼行數:8,代碼來源:BaseSettings.java


注:本文中的com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。