当前位置: 首页>>代码示例>>Java>>正文


Java Id类代码示例

本文整理汇总了Java中com.fasterxml.jackson.annotation.JsonTypeInfo.Id的典型用法代码示例。如果您正苦于以下问题:Java Id类的具体用法?Java Id怎么用?Java Id使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Id类属于com.fasterxml.jackson.annotation.JsonTypeInfo包,在下文中一共展示了Id类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addJsonTypeInfo

import com.fasterxml.jackson.annotation.JsonTypeInfo.Id; //导入依赖的package包/类
private void addJsonTypeInfo(JDefinedClass klass, ObjectTypeDeclaration type) {
    if (!context.getConfig().isJacksonTypeInfo()) {
        return;
    }
    if (type.discriminator() == null) {
        return;
    }
    List<String> derivedTypes = context.getApiModel().findDerivedTypes(type.name());
    if (derivedTypes.isEmpty()) {
        return;
    }
    JAnnotationUse typeInfo = klass.annotate(JsonTypeInfo.class);
    typeInfo.param("use", Id.NAME);
    typeInfo.param("include", As.EXISTING_PROPERTY);
    typeInfo.param("property", type.discriminator());

    JAnnotationUse subTypes = klass.annotate(JsonSubTypes.class);
    JAnnotationArrayMember typeArray = subTypes.paramArray(VALUE);

    for (String derivedType : derivedTypes) {
        JDefinedClass subtype = pkg._getClass(derivedType);
        typeArray.annotate(Type.class).param(VALUE, subtype);
    }
}
 
开发者ID:ops4j,项目名称:org.ops4j.ramler,代码行数:25,代码来源:PojoGeneratingApiVisitor.java

示例2: init

import com.fasterxml.jackson.annotation.JsonTypeInfo.Id; //导入依赖的package包/类
public StdTypeResolverBuilder init(JsonTypeInfo.Id paramId, TypeIdResolver paramTypeIdResolver)
{
  if (paramId == null)
    throw new IllegalArgumentException("idType can not be null");
  this._idType = paramId;
  this._customIdResolver = paramTypeIdResolver;
  this._typeProperty = paramId.getDefaultPropertyName();
  return this;
}
 
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:10,代码来源:StdTypeResolverBuilder.java

示例3: _findTypeResolver

import com.fasterxml.jackson.annotation.JsonTypeInfo.Id; //导入依赖的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

示例4: processType

import com.fasterxml.jackson.annotation.JsonTypeInfo.Id; //导入依赖的package包/类
/**
 * <p>processType</p>
 *
 * @param logger a {@link com.google.gwt.core.ext.TreeLogger} object.
 * @param typeOracle a {@link com.github.nmorel.gwtjackson.rebind.JacksonTypeOracle} object.
 * @param configuration a {@link com.github.nmorel.gwtjackson.rebind.RebindConfiguration} object.
 * @param typeOracle a {@link com.github.nmorel.gwtjackson.rebind.JacksonTypeOracle} object.
 * @param type a {@link com.google.gwt.core.ext.typeinfo.JClassType} object.
 * @param jsonTypeInfo a {@link com.google.gwt.thirdparty.guava.common.base.Optional} object.
 * @param propertySubTypes a {@link com.google.gwt.thirdparty.guava.common.base.Optional} object.
 * @return a {@link com.google.gwt.thirdparty.guava.common.base.Optional} object.
 * @throws com.google.gwt.core.ext.UnableToCompleteException if any.
 */
public static Optional<BeanTypeInfo> processType( TreeLogger logger, JacksonTypeOracle typeOracle, RebindConfiguration configuration,
                                                  JClassType type, Optional<JsonTypeInfo> jsonTypeInfo, Optional<JsonSubTypes>
        propertySubTypes ) throws UnableToCompleteException {

    if ( !jsonTypeInfo.isPresent() ) {
        jsonTypeInfo = findFirstEncounteredAnnotationsOnAllHierarchy( configuration, type, JsonTypeInfo.class );
        if ( !jsonTypeInfo.isPresent() ) {
            return Optional.absent();
        }
    }

    Id use = jsonTypeInfo.get().use();
    As include = jsonTypeInfo.get().include();
    String propertyName = jsonTypeInfo.get().property().isEmpty() ? jsonTypeInfo.get().use().getDefaultPropertyName() : jsonTypeInfo
            .get().property();

    Optional<JsonSubTypes> typeSubTypes = findFirstEncounteredAnnotationsOnAllHierarchy( configuration, type, JsonSubTypes.class );

    // TODO we could do better, we actually extract metadata twice for a lot of classes
    ImmutableMap<JClassType, String> classToSerializationMetadata = extractMetadata( logger, configuration, type, jsonTypeInfo,
            propertySubTypes, typeSubTypes, CreatorUtils
                    .filterSubtypesForSerialization( logger, configuration, type ) );
    ImmutableMap<JClassType, String> classToDeserializationMetadata = extractMetadata( logger, configuration, type, jsonTypeInfo,
            propertySubTypes, typeSubTypes, CreatorUtils
                    .filterSubtypesForDeserialization( logger, configuration, type ) );

    return Optional.of(
            new BeanTypeInfo( use, include, propertyName, classToSerializationMetadata, classToDeserializationMetadata ) );
}
 
开发者ID:nmorel,项目名称:gwt-jackson,代码行数:43,代码来源:BeanProcessor.java

示例5: BeanTypeInfo

import com.fasterxml.jackson.annotation.JsonTypeInfo.Id; //导入依赖的package包/类
BeanTypeInfo( Id use, As include, String propertyName, ImmutableMap<JClassType, String> mapTypeToSerializationMetadata,
              ImmutableMap<JClassType, String> mapTypeToDeserializationMetadata ) {
    this.use = use;
    this.include = include;
    this.propertyName = propertyName;
    this.mapTypeToSerializationMetadata = mapTypeToSerializationMetadata;
    this.mapTypeToDeserializationMetadata = mapTypeToDeserializationMetadata;
}
 
开发者ID:nmorel,项目名称:gwt-jackson,代码行数:9,代码来源:BeanTypeInfo.java

示例6: getMechanism

import com.fasterxml.jackson.annotation.JsonTypeInfo.Id; //导入依赖的package包/类
@Override
public Id getMechanism() {
  return Id.CUSTOM;
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:5,代码来源:EnumTypeIdResolver.java

示例7: getProperties

import com.fasterxml.jackson.annotation.JsonTypeInfo.Id; //导入依赖的package包/类
@JsonTypeInfo(use = Id.CLASS, defaultImpl = RestFormProperty.class)
public List<RestFormProperty> getProperties() {
    return properties;
}
 
开发者ID:flowable,项目名称:flowable-engine,代码行数:5,代码来源:SubmitFormRequest.java

示例8: getVariables

import com.fasterxml.jackson.annotation.JsonTypeInfo.Id; //导入依赖的package包/类
@JsonTypeInfo(use = Id.CLASS, defaultImpl = QueryVariable.class)
public List<QueryVariable> getVariables() {
    return variables;
}
 
开发者ID:flowable,项目名称:flowable-engine,代码行数:5,代码来源:ProcessInstanceQueryRequest.java

示例9: getVariables

import com.fasterxml.jackson.annotation.JsonTypeInfo.Id; //导入依赖的package包/类
@JsonTypeInfo(use = Id.CLASS, defaultImpl = RestVariable.class)
@ApiModelProperty(value = "Array of variables (in the general variables format) to use as payload to pass along with the signal. Cannot be used in case async is set to true, this will result in an error.")
public List<RestVariable> getVariables() {
    return variables;
}
 
开发者ID:flowable,项目名称:flowable-engine,代码行数:6,代码来源:SignalEventReceivedRequest.java

示例10: getVariables

import com.fasterxml.jackson.annotation.JsonTypeInfo.Id; //导入依赖的package包/类
@JsonTypeInfo(use = Id.CLASS, defaultImpl = RestVariable.class)
public List<RestVariable> getVariables() {
    return variables;
}
 
开发者ID:flowable,项目名称:flowable-engine,代码行数:5,代码来源:ProcessInstanceCreateRequest.java

示例11: getTransientVariables

import com.fasterxml.jackson.annotation.JsonTypeInfo.Id; //导入依赖的package包/类
@JsonTypeInfo(use = Id.CLASS, defaultImpl = RestVariable.class)
public List<RestVariable> getTransientVariables() {
    return transientVariables;
}
 
开发者ID:flowable,项目名称:flowable-engine,代码行数:5,代码来源:ProcessInstanceCreateRequest.java

示例12: setProcessInstanceVariables

import com.fasterxml.jackson.annotation.JsonTypeInfo.Id; //导入依赖的package包/类
@JsonTypeInfo(use = Id.CLASS, defaultImpl = QueryVariable.class)
public void setProcessInstanceVariables(List<QueryVariable> processInstanceVariables) {
    this.processInstanceVariables = processInstanceVariables;
}
 
开发者ID:flowable,项目名称:flowable-engine,代码行数:5,代码来源:ExecutionQueryRequest.java

示例13: getTaskVariables

import com.fasterxml.jackson.annotation.JsonTypeInfo.Id; //导入依赖的package包/类
@JsonTypeInfo(use = Id.CLASS, defaultImpl = QueryVariable.class)
public List<QueryVariable> getTaskVariables() {
    return taskVariables;
}
 
开发者ID:flowable,项目名称:flowable-engine,代码行数:5,代码来源:TaskQueryRequest.java

示例14: getProcessInstanceVariables

import com.fasterxml.jackson.annotation.JsonTypeInfo.Id; //导入依赖的package包/类
@JsonTypeInfo(use = Id.CLASS, defaultImpl = QueryVariable.class)
public List<QueryVariable> getProcessInstanceVariables() {
    return processInstanceVariables;
}
 
开发者ID:flowable,项目名称:flowable-engine,代码行数:5,代码来源:TaskQueryRequest.java

示例15: getVariables

import com.fasterxml.jackson.annotation.JsonTypeInfo.Id; //导入依赖的package包/类
@ApiModelProperty(value = "If action is complete, you can use this parameter to set variables ")
@JsonTypeInfo(use = Id.CLASS, defaultImpl = RestVariable.class)
public List<RestVariable> getVariables() {
    return variables;
}
 
开发者ID:flowable,项目名称:flowable-engine,代码行数:6,代码来源:TaskActionRequest.java


注:本文中的com.fasterxml.jackson.annotation.JsonTypeInfo.Id类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。