本文整理匯總了Java中com.fasterxml.jackson.databind.AnnotationIntrospector類的典型用法代碼示例。如果您正苦於以下問題:Java AnnotationIntrospector類的具體用法?Java AnnotationIntrospector怎麽用?Java AnnotationIntrospector使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
AnnotationIntrospector類屬於com.fasterxml.jackson.databind包,在下文中一共展示了AnnotationIntrospector類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: objectMapper
import com.fasterxml.jackson.databind.AnnotationIntrospector; //導入依賴的package包/類
@Bean
public ObjectMapper objectMapper() {
ObjectMapper mapper = new ObjectMapper();
mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
mapper.registerModule(new Ocpp12JacksonModule());
mapper.registerModule(new Ocpp15JacksonModule());
mapper.setAnnotationIntrospector(
AnnotationIntrospector.pair(
new JacksonAnnotationIntrospector(),
new JaxbAnnotationIntrospector(mapper.getTypeFactory())
)
);
return mapper;
}
示例2: collectAndResolveSubtypes
import com.fasterxml.jackson.databind.AnnotationIntrospector; //導入依賴的package包/類
public Collection<NamedType> collectAndResolveSubtypes(AnnotatedClass paramAnnotatedClass, MapperConfig<?> paramMapperConfig, AnnotationIntrospector paramAnnotationIntrospector)
{
HashMap localHashMap = new HashMap();
if (this._registeredSubtypes != null)
{
Class localClass = paramAnnotatedClass.getRawType();
Iterator localIterator = this._registeredSubtypes.iterator();
while (localIterator.hasNext())
{
NamedType localNamedType = (NamedType)localIterator.next();
if (localClass.isAssignableFrom(localNamedType.getType()))
_collectAndResolve(AnnotatedClass.constructWithoutSuperTypes(localNamedType.getType(), paramAnnotationIntrospector, paramMapperConfig), localNamedType, paramMapperConfig, paramAnnotationIntrospector, localHashMap);
}
}
_collectAndResolve(paramAnnotatedClass, new NamedType(paramAnnotatedClass.getRawType(), null), paramMapperConfig, paramAnnotationIntrospector, localHashMap);
return new ArrayList(localHashMap.values());
}
示例3: findConvertingContentSerializer
import com.fasterxml.jackson.databind.AnnotationIntrospector; //導入依賴的package包/類
public JsonSerializer<?> findConvertingContentSerializer(SerializerProvider paramSerializerProvider, BeanProperty paramBeanProperty, JsonSerializer<?> paramJsonSerializer)
{
AnnotationIntrospector localAnnotationIntrospector = paramSerializerProvider.getAnnotationIntrospector();
if ((localAnnotationIntrospector != null) && (paramBeanProperty != null))
{
Object localObject = localAnnotationIntrospector.findSerializationContentConverter(paramBeanProperty.getMember());
if (localObject != null)
{
Converter localConverter = paramSerializerProvider.converterInstance(paramBeanProperty.getMember(), localObject);
JavaType localJavaType = localConverter.getOutputType(paramSerializerProvider.getTypeFactory());
if (paramJsonSerializer == null)
paramJsonSerializer = paramSerializerProvider.findValueSerializer(localJavaType, paramBeanProperty);
return new StdDelegatingSerializer(localConverter, localJavaType, paramJsonSerializer);
}
}
return paramJsonSerializer;
}
示例4: createTypeSerializer
import com.fasterxml.jackson.databind.AnnotationIntrospector; //導入依賴的package包/類
public TypeSerializer createTypeSerializer(SerializationConfig paramSerializationConfig, JavaType paramJavaType)
{
AnnotatedClass localAnnotatedClass = paramSerializationConfig.introspectClassAnnotations(paramJavaType.getRawClass()).getClassInfo();
AnnotationIntrospector localAnnotationIntrospector = paramSerializationConfig.getAnnotationIntrospector();
TypeResolverBuilder localTypeResolverBuilder = localAnnotationIntrospector.findTypeResolver(paramSerializationConfig, localAnnotatedClass, paramJavaType);
Collection localCollection;
if (localTypeResolverBuilder == null)
{
localTypeResolverBuilder = paramSerializationConfig.getDefaultTyper(paramJavaType);
localCollection = null;
}
else
{
localCollection = paramSerializationConfig.getSubtypeResolver().collectAndResolveSubtypes(localAnnotatedClass, paramSerializationConfig, localAnnotationIntrospector);
}
if (localTypeResolverBuilder == null)
return null;
return localTypeResolverBuilder.buildTypeSerializer(paramSerializationConfig, paramJavaType, localCollection);
}
示例5: findBackReferenceProperties
import com.fasterxml.jackson.databind.AnnotationIntrospector; //導入依賴的package包/類
public Map<String, AnnotatedMember> findBackReferenceProperties()
{
HashMap localHashMap = null;
Iterator localIterator = this._properties.iterator();
while (localIterator.hasNext())
{
AnnotatedMember localAnnotatedMember = ((BeanPropertyDefinition)localIterator.next()).getMutator();
if (localAnnotatedMember != null)
{
AnnotationIntrospector.ReferenceProperty localReferenceProperty = this._annotationIntrospector.findReferenceType(localAnnotatedMember);
if ((localReferenceProperty != null) && (localReferenceProperty.isBackReference()))
{
if (localHashMap == null)
localHashMap = new HashMap();
String str = localReferenceProperty.getName();
if (localHashMap.put(str, localAnnotatedMember) != null)
throw new IllegalArgumentException("Multiple back-reference properties with name '" + str + "'");
}
}
}
return localHashMap;
}
示例6: POJOPropertiesCollector
import com.fasterxml.jackson.databind.AnnotationIntrospector; //導入依賴的package包/類
protected POJOPropertiesCollector(MapperConfig<?> paramMapperConfig, boolean paramBoolean, JavaType paramJavaType, AnnotatedClass paramAnnotatedClass, String paramString)
{
this._config = paramMapperConfig;
this._forSerialization = paramBoolean;
this._type = paramJavaType;
this._classDef = paramAnnotatedClass;
String str;
if (paramString == null)
str = "set";
else
str = paramString;
this._mutatorPrefix = str;
AnnotationIntrospector localAnnotationIntrospector;
if (paramMapperConfig.isAnnotationProcessingEnabled())
localAnnotationIntrospector = this._config.getAnnotationIntrospector();
else
localAnnotationIntrospector = null;
this._annotationIntrospector = localAnnotationIntrospector;
if (this._annotationIntrospector == null)
{
this._visibilityChecker = this._config.getDefaultVisibilityChecker();
return;
}
this._visibilityChecker = this._annotationIntrospector.findAutoDetectVisibility(paramAnnotatedClass, this._config.getDefaultVisibilityChecker());
}
示例7: _addInjectables
import com.fasterxml.jackson.databind.AnnotationIntrospector; //導入依賴的package包/類
protected void _addInjectables()
{
AnnotationIntrospector localAnnotationIntrospector = this._annotationIntrospector;
if (localAnnotationIntrospector == null)
return;
Iterator localIterator1 = this._classDef.fields().iterator();
while (localIterator1.hasNext())
{
AnnotatedField localAnnotatedField = (AnnotatedField)localIterator1.next();
_doAddInjectable(localAnnotationIntrospector.findInjectableValueId(localAnnotatedField), localAnnotatedField);
}
Iterator localIterator2 = this._classDef.memberMethods().iterator();
while (localIterator2.hasNext())
{
AnnotatedMethod localAnnotatedMethod = (AnnotatedMethod)localIterator2.next();
if (localAnnotatedMethod.getParameterCount() == 1)
_doAddInjectable(localAnnotationIntrospector.findInjectableValueId(localAnnotatedMethod), localAnnotatedMethod);
}
}
示例8: _addMethods
import com.fasterxml.jackson.databind.AnnotationIntrospector; //導入依賴的package包/類
protected void _addMethods()
{
AnnotationIntrospector localAnnotationIntrospector = this._annotationIntrospector;
Iterator localIterator = this._classDef.memberMethods().iterator();
while (localIterator.hasNext())
{
AnnotatedMethod localAnnotatedMethod = (AnnotatedMethod)localIterator.next();
int i = localAnnotatedMethod.getParameterCount();
if (i == 0)
{
_addGetterMethod(localAnnotatedMethod, localAnnotationIntrospector);
}
else if (i == 1)
{
_addSetterMethod(localAnnotatedMethod, localAnnotationIntrospector);
}
else if ((i == 2) && (localAnnotationIntrospector != null) && (localAnnotationIntrospector.hasAnySetterAnnotation(localAnnotatedMethod)))
{
if (this._anySetters == null)
this._anySetters = new LinkedList();
this._anySetters.add(localAnnotatedMethod);
}
}
}
示例9: collectPropertiesWithBuilder
import com.fasterxml.jackson.databind.AnnotationIntrospector; //導入依賴的package包/類
protected POJOPropertiesCollector collectPropertiesWithBuilder(MapperConfig<?> paramMapperConfig, JavaType paramJavaType, ClassIntrospector.MixInResolver paramMixInResolver, boolean paramBoolean)
{
AnnotationIntrospector localAnnotationIntrospector;
if (paramMapperConfig.isAnnotationProcessingEnabled())
localAnnotationIntrospector = paramMapperConfig.getAnnotationIntrospector();
else
localAnnotationIntrospector = null;
AnnotatedClass localAnnotatedClass = AnnotatedClass.construct(paramJavaType.getRawClass(), localAnnotationIntrospector, paramMixInResolver);
JsonPOJOBuilder.Value localValue1;
if (localAnnotationIntrospector == null)
localValue1 = null;
else
localValue1 = localAnnotationIntrospector.findPOJOBuilderConfig(localAnnotatedClass);
JsonPOJOBuilder.Value localValue2 = localValue1;
String str;
if (localValue1 == null)
str = "with";
else
str = localValue2.withPrefix;
return constructPropertyCollector(paramMapperConfig, localAnnotatedClass, paramJavaType, paramBoolean, str).collect();
}
示例10: findTypeDeserializer
import com.fasterxml.jackson.databind.AnnotationIntrospector; //導入依賴的package包/類
public TypeDeserializer findTypeDeserializer(DeserializationConfig paramDeserializationConfig, JavaType paramJavaType)
{
AnnotatedClass localAnnotatedClass = paramDeserializationConfig.introspectClassAnnotations(paramJavaType.getRawClass()).getClassInfo();
AnnotationIntrospector localAnnotationIntrospector = paramDeserializationConfig.getAnnotationIntrospector();
Object localObject = localAnnotationIntrospector.findTypeResolver(paramDeserializationConfig, localAnnotatedClass, paramJavaType);
Collection localCollection;
if (localObject == null)
{
TypeResolverBuilder localTypeResolverBuilder = paramDeserializationConfig.getDefaultTyper(paramJavaType);
localObject = localTypeResolverBuilder;
localCollection = null;
if (localTypeResolverBuilder == null)
return null;
}
else
{
localCollection = paramDeserializationConfig.getSubtypeResolver().collectAndResolveSubtypes(localAnnotatedClass, paramDeserializationConfig, localAnnotationIntrospector);
}
if ((((TypeResolverBuilder)localObject).getDefaultImpl() == null) && (paramJavaType.isAbstract()))
{
JavaType localJavaType = mapAbstractType(paramDeserializationConfig, paramJavaType);
if ((localJavaType != null) && (localJavaType.getRawClass() != paramJavaType.getRawClass()))
localObject = ((TypeResolverBuilder)localObject).defaultImpl(localJavaType.getRawClass());
}
return ((TypeResolverBuilder)localObject).buildTypeDeserializer(paramDeserializationConfig, paramJavaType, localCollection);
}
示例11: findConvertingContentDeserializer
import com.fasterxml.jackson.databind.AnnotationIntrospector; //導入依賴的package包/類
protected JsonDeserializer<?> findConvertingContentDeserializer(DeserializationContext paramDeserializationContext, BeanProperty paramBeanProperty, JsonDeserializer<?> paramJsonDeserializer)
{
AnnotationIntrospector localAnnotationIntrospector = paramDeserializationContext.getAnnotationIntrospector();
if ((localAnnotationIntrospector != null) && (paramBeanProperty != null))
{
Object localObject = localAnnotationIntrospector.findDeserializationContentConverter(paramBeanProperty.getMember());
if (localObject != null)
{
Converter localConverter = paramDeserializationContext.converterInstance(paramBeanProperty.getMember(), localObject);
JavaType localJavaType = localConverter.getInputType(paramDeserializationContext.getTypeFactory());
if (paramJsonDeserializer == null)
paramJsonDeserializer = paramDeserializationContext.findContextualValueDeserializer(localJavaType, paramBeanProperty);
return new StdDelegatingDeserializer(localConverter, localJavaType, paramJsonDeserializer);
}
}
return paramJsonDeserializer;
}
示例12: constructSettableProperty
import com.fasterxml.jackson.databind.AnnotationIntrospector; //導入依賴的package包/類
protected SettableBeanProperty constructSettableProperty(DeserializationContext paramDeserializationContext, BeanDescription paramBeanDescription, BeanPropertyDefinition paramBeanPropertyDefinition, Type paramType)
{
AnnotatedMember localAnnotatedMember = paramBeanPropertyDefinition.getMutator();
if (paramDeserializationContext.canOverrideAccessModifiers())
localAnnotatedMember.fixAccess();
JavaType localJavaType1 = paramBeanDescription.resolveType(paramType);
BeanProperty.Std localStd = new BeanProperty.Std(paramBeanPropertyDefinition.getName(), localJavaType1, paramBeanPropertyDefinition.getWrapperName(), paramBeanDescription.getClassAnnotations(), localAnnotatedMember, paramBeanPropertyDefinition.isRequired());
JavaType localJavaType2 = resolveType(paramDeserializationContext, paramBeanDescription, localJavaType1, localAnnotatedMember);
if (localJavaType2 != localJavaType1)
localStd.withType(localJavaType2);
JsonDeserializer localJsonDeserializer = findDeserializerFromAnnotation(paramDeserializationContext, localAnnotatedMember);
JavaType localJavaType3 = modifyTypeByAnnotation(paramDeserializationContext, localAnnotatedMember, localJavaType2);
TypeDeserializer localTypeDeserializer = (TypeDeserializer)localJavaType3.getTypeHandler();
Object localObject;
if ((localAnnotatedMember instanceof AnnotatedMethod))
localObject = new MethodProperty(paramBeanPropertyDefinition, localJavaType3, localTypeDeserializer, paramBeanDescription.getClassAnnotations(), (AnnotatedMethod)localAnnotatedMember);
else
localObject = new FieldProperty(paramBeanPropertyDefinition, localJavaType3, localTypeDeserializer, paramBeanDescription.getClassAnnotations(), (AnnotatedField)localAnnotatedMember);
if (localJsonDeserializer != null)
localObject = ((SettableBeanProperty)localObject).withValueDeserializer(localJsonDeserializer);
AnnotationIntrospector.ReferenceProperty localReferenceProperty = paramBeanPropertyDefinition.findReferenceType();
if ((localReferenceProperty != null) && (localReferenceProperty.isManagedReference()))
((SettableBeanProperty)localObject).setManagedReferenceName(localReferenceProperty.getName());
return localObject;
}
示例13: constructFromName
import com.fasterxml.jackson.databind.AnnotationIntrospector; //導入依賴的package包/類
public static EnumValues constructFromName(Class<Enum<?>> paramClass, AnnotationIntrospector paramAnnotationIntrospector)
{
Enum[] arrayOfEnum = (Enum[])ClassUtil.findEnumType(paramClass).getEnumConstants();
if (arrayOfEnum != null)
{
HashMap localHashMap = new HashMap();
int i = arrayOfEnum.length;
for (int j = 0; j < i; j++)
{
Enum localEnum = arrayOfEnum[j];
localHashMap.put(localEnum, new SerializedString(paramAnnotationIntrospector.findEnumValue(localEnum)));
}
return new EnumValues(paramClass, localHashMap);
}
throw new IllegalArgumentException("Can not determine enum constants for Class " + paramClass.getName());
}
示例14: constructFromToString
import com.fasterxml.jackson.databind.AnnotationIntrospector; //導入依賴的package包/類
public static EnumValues constructFromToString(Class<Enum<?>> paramClass, AnnotationIntrospector paramAnnotationIntrospector)
{
Enum[] arrayOfEnum = (Enum[])ClassUtil.findEnumType(paramClass).getEnumConstants();
if (arrayOfEnum != null)
{
HashMap localHashMap = new HashMap();
int i = arrayOfEnum.length;
for (int j = 0; j < i; j++)
{
Enum localEnum = arrayOfEnum[j];
localHashMap.put(localEnum, new SerializedString(localEnum.toString()));
}
return new EnumValues(paramClass, localHashMap);
}
throw new IllegalArgumentException("Can not determine enum constants for Class " + paramClass.getName());
}
示例15: collectAndResolveSubtypes
import com.fasterxml.jackson.databind.AnnotationIntrospector; //導入依賴的package包/類
@Override
public Collection<NamedType> collectAndResolveSubtypes(AnnotatedClass type,
MapperConfig<?> config, AnnotationIntrospector ai)
{
HashMap<NamedType, NamedType> subtypes = new HashMap<NamedType, NamedType>();
// [JACKSON-257] then consider registered subtypes (which have precedence over annotations)
if (_registeredSubtypes != null) {
Class<?> rawBase = type.getRawType();
for (NamedType subtype : _registeredSubtypes) {
// is it a subtype of root type?
if (rawBase.isAssignableFrom(subtype.getType())) { // yes
AnnotatedClass curr = AnnotatedClass.constructWithoutSuperTypes(subtype.getType(), ai, config);
_collectAndResolve(curr, subtype, config, ai, subtypes);
}
}
}
// and then check subtypes via annotations from base type (recursively)
NamedType rootType = new NamedType(type.getRawType(), null);
_collectAndResolve(type, rootType, config, ai, subtypes);
return new ArrayList<NamedType>(subtypes.values());
}