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


Java JsonTypeInfo.As方法代碼示例

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


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

示例1: saveType

import com.fasterxml.jackson.annotation.JsonTypeInfo; //導入方法依賴的package包/類
private void saveType(String path, T object, KeyValueStorage storage) {
    Class<?> clazz = object.getClass();
    String name = PROP_TYPE;
    String value = clazz.getName();
    JsonTypeInfo typeInfo = AnnotationUtils.findAnnotation(clazz, JsonTypeInfo.class);
    if (typeInfo != null && !clazz.equals(typeInfo.defaultImpl())) {
        JsonTypeInfo.As include = typeInfo.include();
        if(include != JsonTypeInfo.As.PROPERTY &&
           include != JsonTypeInfo.As.EXTERNAL_PROPERTY /* it for capability with jackson oddities */) {
            throw new IllegalArgumentException("On " + clazz + " mapping support only " + JsonTypeInfo.As.PROPERTY + " but find: " + include);
        }
        name = getPropertyName(typeInfo);
        value = getJsonType(clazz, typeInfo);
    }
    storage.set(KvUtils.join(path, name), value);
}
 
開發者ID:codeabovelab,項目名稱:haven-platform,代碼行數:17,代碼來源:NodeMapping.java

示例2: _findTypeResolver

import com.fasterxml.jackson.annotation.JsonTypeInfo; //導入方法依賴的package包/類
protected TypeResolverBuilder<?> _findTypeResolver(MapperConfig<?> paramMapperConfig, Annotated paramAnnotated, JavaType paramJavaType)
{
  JsonTypeInfo localJsonTypeInfo = (JsonTypeInfo)paramAnnotated.getAnnotation(JsonTypeInfo.class);
  JsonTypeResolver localJsonTypeResolver = (JsonTypeResolver)paramAnnotated.getAnnotation(JsonTypeResolver.class);
  Object localObject;
  if (localJsonTypeResolver != null)
  {
    if (localJsonTypeInfo == null)
      return null;
    localObject = paramMapperConfig.typeResolverBuilderInstance(paramAnnotated, localJsonTypeResolver.value());
  }
  else
  {
    if (localJsonTypeInfo == null)
      return null;
    if (localJsonTypeInfo.use() == JsonTypeInfo.Id.NONE)
      return _constructNoTypeResolverBuilder();
    localObject = _constructStdTypeResolverBuilder();
  }
  JsonTypeIdResolver localJsonTypeIdResolver = (JsonTypeIdResolver)paramAnnotated.getAnnotation(JsonTypeIdResolver.class);
  TypeIdResolver localTypeIdResolver1;
  if (localJsonTypeIdResolver == null)
    localTypeIdResolver1 = null;
  else
    localTypeIdResolver1 = paramMapperConfig.typeIdResolverInstance(paramAnnotated, localJsonTypeIdResolver.value());
  TypeIdResolver localTypeIdResolver2 = localTypeIdResolver1;
  if (localTypeIdResolver1 != null)
    localTypeIdResolver2.init(paramJavaType);
  TypeResolverBuilder localTypeResolverBuilder1 = ((TypeResolverBuilder)localObject).init(localJsonTypeInfo.use(), localTypeIdResolver2);
  JsonTypeInfo.As localAs1 = localJsonTypeInfo.include();
  JsonTypeInfo.As localAs2 = localAs1;
  if ((localAs1 == JsonTypeInfo.As.EXTERNAL_PROPERTY) && ((paramAnnotated instanceof AnnotatedClass)))
    localAs2 = JsonTypeInfo.As.PROPERTY;
  TypeResolverBuilder localTypeResolverBuilder2 = localTypeResolverBuilder1.inclusion(localAs2).typeProperty(localJsonTypeInfo.property());
  Class localClass = localJsonTypeInfo.defaultImpl();
  if (localClass != JsonTypeInfo.None.class)
    localTypeResolverBuilder2 = localTypeResolverBuilder2.defaultImpl(localClass);
  return localTypeResolverBuilder2.typeIdVisibility(localJsonTypeInfo.visible());
}
 
開發者ID:mmmsplay10,項目名稱:QuizUpWinner,代碼行數:40,代碼來源:JacksonAnnotationIntrospector.java

示例3: CodecTypeDeserializer

import com.fasterxml.jackson.annotation.JsonTypeInfo; //導入方法依賴的package包/類
protected CodecTypeDeserializer(PluginMap pluginMap, JsonTypeInfo.As inludeAs,
                                JavaType baseType, CodecTypeIdResolver idRes,
                                String typePropertyName, boolean typeIdVisible,
                                JavaType defaultImpl) {
    super(baseType, idRes, typePropertyName, typeIdVisible, defaultImpl);
    this.pluginMap = pluginMap;
    this.inludeAs = inludeAs;
    this.idRes = idRes;
}
 
開發者ID:addthis,項目名稱:codec,代碼行數:10,代碼來源:CodecTypeDeserializer.java

示例4: inclusion

import com.fasterxml.jackson.annotation.JsonTypeInfo; //導入方法依賴的package包/類
public StdTypeResolverBuilder inclusion(JsonTypeInfo.As includeAs) {
    if (includeAs == null) {
        throw new IllegalArgumentException("includeAs can not be null");
    }
    _includeAs = includeAs;
    return this;
}
 
開發者ID:joyplus,項目名稱:joyplus-tv,代碼行數:8,代碼來源:StdTypeResolverBuilder.java

示例5: inclusion

import com.fasterxml.jackson.annotation.JsonTypeInfo; //導入方法依賴的package包/類
@Override
public MetadataTypeResolver inclusion(JsonTypeInfo.As includeAs) {
    return this;
}
 
開發者ID:zalando-nakadi,項目名稱:fahrschein,代碼行數:5,代碼來源:MetadataTypeResolver.java

示例6: getTypeInclusion

import com.fasterxml.jackson.annotation.JsonTypeInfo; //導入方法依賴的package包/類
@Override
public JsonTypeInfo.As getTypeInclusion() {
    return JsonTypeInfo.As.EXISTING_PROPERTY;
}
 
開發者ID:zalando-nakadi,項目名稱:fahrschein,代碼行數:5,代碼來源:MetadataTypeResolver.java

示例7: getTypeInclusion

import com.fasterxml.jackson.annotation.JsonTypeInfo; //導入方法依賴的package包/類
@Override
public JsonTypeInfo.As getTypeInclusion() {
    return inludeAs;
}
 
開發者ID:addthis,項目名稱:codec,代碼行數:5,代碼來源:CodecTypeDeserializer.java

示例8: getTypeInclusion

import com.fasterxml.jackson.annotation.JsonTypeInfo; //導入方法依賴的package包/類
@Override
public abstract JsonTypeInfo.As getTypeInclusion();
 
開發者ID:joyplus,項目名稱:joyplus-tv,代碼行數:3,代碼來源:TypeSerializerBase.java

示例9: getTypeInclusion

import com.fasterxml.jackson.annotation.JsonTypeInfo; //導入方法依賴的package包/類
/**
 * Accessor for type information inclusion method
 * that serializer uses; indicates how type information
 * is embedded in resulting JSON.
 */
public abstract JsonTypeInfo.As getTypeInclusion();
 
開發者ID:joyplus,項目名稱:joyplus-tv,代碼行數:7,代碼來源:TypeSerializer.java


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