Class JacksonXmlAnnotationIntrospector
- java.lang.Object
-
- com.fasterxml.jackson.databind.AnnotationIntrospector
-
- com.fasterxml.jackson.databind.introspect.JacksonAnnotationIntrospector
-
- com.fasterxml.jackson.dataformat.xml.JacksonXmlAnnotationIntrospector
-
- All Implemented Interfaces:
Versioned,AnnotationIntrospector.XmlExtensions,XmlAnnotationIntrospector,java.io.Serializable
public class JacksonXmlAnnotationIntrospector extends JacksonAnnotationIntrospector implements XmlAnnotationIntrospector
Extension ofJacksonAnnotationIntrospectorthat is needed to support additional xml-specific annotation that Jackson provides. Note, however, that there is no JAXB annotation support here; that is provided with separate introspector (see https://github.com/FasterXML/jackson-modules-base/tree/master/jaxb, classcom.fasterxml.jackson.module.jaxb.JaxbAnnotationIntrospector).- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.fasterxml.jackson.databind.AnnotationIntrospector
AnnotationIntrospector.ReferenceProperty, AnnotationIntrospector.XmlExtensions
-
Nested classes/interfaces inherited from interface com.fasterxml.jackson.dataformat.xml.XmlAnnotationIntrospector
XmlAnnotationIntrospector.Pair
-
-
Field Summary
Fields Modifier and Type Field Description static booleanDEFAULT_USE_WRAPPERFor backwards compatibility with 2.0, the default behavior is to assume use of List wrapper if no annotations are used.
-
Constructor Summary
Constructors Constructor Description JacksonXmlAnnotationIntrospector()JacksonXmlAnnotationIntrospector(boolean defaultUseWrapper)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidfindAndAddVirtualProperties(MapperConfig<?> config, AnnotatedClass ac, java.util.List<BeanPropertyWriter> properties)Due to issue [dataformat-xml#578] need to suppress calls to this method to avoid duplicate virtual properties from being added.PropertyNamefindNameForDeserialization(Annotated a)Method for checking whether given property accessors (method, field) has an annotation that suggests property name to use for deserialization (reading JSON into POJOs).PropertyNamefindNameForSerialization(Annotated a)Method for checking whether given property accessors (method, field) has an annotation that suggests property name to use for serialization.java.lang.StringfindNamespace(MapperConfig<?> config, Annotated ann)Method that can be called to figure out generic namespace property for an annotated object.PropertyNamefindRootName(AnnotatedClass ac)Method for locating name used as "root name" (for use by some serializers when outputting root-level object -- mostly for XML compatibility purposes) for given class, if one is defined.PropertyNamefindWrapperName(Annotated ann)Method used to check if specified property has annotation that indicates that it should be wrapped in an element; and if so, name to use.java.lang.BooleanisOutputAsAttribute(MapperConfig<?> config, Annotated ann)Method used to check whether given annotated element (field, method, constructor parameter) has indicator that suggests it be output as an XML attribute or not (if not, then as element)java.lang.BooleanisOutputAsCData(MapperConfig<?> config, Annotated ann)Method used to check whether given annotated element (field, method, constructor parameter) has indicator that suggests it should be wrapped in a CDATA tag.java.lang.BooleanisOutputAsText(MapperConfig<?> config, Annotated ann)Method used to check whether given annotated element (field, method, constructor parameter) has indicator that suggests it should be serialized as text, without element wrapper.voidsetDefaultUseWrapper(boolean b)-
Methods inherited from class com.fasterxml.jackson.databind.introspect.JacksonAnnotationIntrospector
findAutoDetectVisibility, findClassDescription, findContentDeserializer, findContentSerializer, findCreatorAnnotation, findCreatorBinding, findDefaultEnumValue, findDefaultEnumValue, findDeserializationContentConverter, findDeserializationConverter, findDeserializer, findEnumAliases, findEnumAliases, findEnumNamingStrategy, findEnumValue, findEnumValues, findEnumValues, findFilterId, findFormat, findImplicitPropertyName, findInjectableValue, findInjectableValueId, findKeyDeserializer, findKeySerializer, findMergeInfo, findNamingStrategy, findNullSerializer, findObjectIdInfo, findObjectReferenceInfo, findPOJOBuilder, findPOJOBuilderConfig, findPolymorphicTypeInfo, findPropertyAccess, findPropertyAliases, findPropertyContentTypeResolver, findPropertyDefaultValue, findPropertyDescription, findPropertyIgnoralByName, findPropertyIgnorals, findPropertyInclusion, findPropertyInclusionByName, findPropertyIndex, findPropertyTypeResolver, findReferenceType, findRenameByField, findSerializationContentConverter, findSerializationConverter, findSerializationPropertyOrder, findSerializationSortAlphabetically, findSerializationTyping, findSerializer, findSetterInfo, findSubtypes, findTypeName, findTypeResolver, findUnwrappingNameTransformer, findValueInstantiator, findViews, hasAnyGetter, hasAnyGetterAnnotation, hasAnySetter, hasAnySetterAnnotation, hasAsKey, hasAsValue, hasAsValueAnnotation, hasCreatorAnnotation, hasIgnoreMarker, hasRequiredMarker, isAnnotationBundle, isIgnorableType, isTypeId, refineDeserializationType, refineSerializationType, resolveSetterConflict, setConstructorPropertiesImpliesCreator, version
-
Methods inherited from class com.fasterxml.jackson.databind.AnnotationIntrospector
allIntrospectors, allIntrospectors, nopInstance, pair
-
-
-
-
Field Detail
-
DEFAULT_USE_WRAPPER
public static final boolean DEFAULT_USE_WRAPPER
For backwards compatibility with 2.0, the default behavior is to assume use of List wrapper if no annotations are used.- See Also:
- Constant Field Values
-
-
Method Detail
-
setDefaultUseWrapper
public void setDefaultUseWrapper(boolean b)
-
findWrapperName
public PropertyName findWrapperName(Annotated ann)
Description copied from class:AnnotationIntrospectorMethod used to check if specified property has annotation that indicates that it should be wrapped in an element; and if so, name to use. Note that not all serializers and deserializers support use this method: currently (2.1) it is only used by XML-backed handlers.- Overrides:
findWrapperNamein classAnnotationIntrospector- Returns:
- Wrapper name to use, if any, or
PropertyName.USE_DEFAULTto indicate that no wrapper element should be used.
-
findRootName
public PropertyName findRootName(AnnotatedClass ac)
Description copied from class:AnnotationIntrospectorMethod for locating name used as "root name" (for use by some serializers when outputting root-level object -- mostly for XML compatibility purposes) for given class, if one is defined. Returns null if no declaration found; can return explicit empty String, which is usually ignored as well as null.NOTE: method signature changed in 2.1, to return
PropertyNameinstead of String.- Overrides:
findRootNamein classJacksonAnnotationIntrospector- Parameters:
ac- Annotated class to introspect- Returns:
- Root name to use, if any;
nullif not
-
findNamespace
public java.lang.String findNamespace(MapperConfig<?> config, Annotated ann)
Description copied from interface:AnnotationIntrospector.XmlExtensionsMethod that can be called to figure out generic namespace property for an annotated object.- Specified by:
findNamespacein interfaceAnnotationIntrospector.XmlExtensions- Parameters:
config- Configuration settings in effectann- Annotated entity to introspect- Returns:
- Null if annotated thing does not define any namespace information; non-null namespace (which may be empty String) otherwise.
-
findAndAddVirtualProperties
public void findAndAddVirtualProperties(MapperConfig<?> config, AnnotatedClass ac, java.util.List<BeanPropertyWriter> properties)
Due to issue [dataformat-xml#578] need to suppress calls to this method to avoid duplicate virtual properties from being added. Not elegant but .. works.- Overrides:
findAndAddVirtualPropertiesin classJacksonAnnotationIntrospector- Since:
- 2.15
-
isOutputAsAttribute
public java.lang.Boolean isOutputAsAttribute(MapperConfig<?> config, Annotated ann)
Description copied from interface:AnnotationIntrospector.XmlExtensionsMethod used to check whether given annotated element (field, method, constructor parameter) has indicator that suggests it be output as an XML attribute or not (if not, then as element)- Specified by:
isOutputAsAttributein interfaceAnnotationIntrospector.XmlExtensions- Parameters:
config- Configuration settings in effectann- Annotated entity to introspect- Returns:
- Null if no indicator found;
TrueorFalseotherwise
-
isOutputAsText
public java.lang.Boolean isOutputAsText(MapperConfig<?> config, Annotated ann)
Description copied from interface:AnnotationIntrospector.XmlExtensionsMethod used to check whether given annotated element (field, method, constructor parameter) has indicator that suggests it should be serialized as text, without element wrapper.- Specified by:
isOutputAsTextin interfaceAnnotationIntrospector.XmlExtensions- Parameters:
config- Configuration settings in effectann- Annotated entity to introspect- Returns:
- Null if no indicator found;
TrueorFalseotherwise
-
isOutputAsCData
public java.lang.Boolean isOutputAsCData(MapperConfig<?> config, Annotated ann)
Description copied from interface:AnnotationIntrospector.XmlExtensionsMethod used to check whether given annotated element (field, method, constructor parameter) has indicator that suggests it should be wrapped in a CDATA tag.- Specified by:
isOutputAsCDatain interfaceAnnotationIntrospector.XmlExtensions- Parameters:
config- Configuration settings in effectann- Annotated entity to introspect- Returns:
- Null if no indicator found;
TrueorFalseotherwise
-
findNameForSerialization
public PropertyName findNameForSerialization(Annotated a)
Description copied from class:AnnotationIntrospectorMethod for checking whether given property accessors (method, field) has an annotation that suggests property name to use for serialization. Should return null if no annotation is found; otherwise a non-null name (possiblyPropertyName.USE_DEFAULT, which means "use default heuristics").- Overrides:
findNameForSerializationin classJacksonAnnotationIntrospector- Parameters:
a- Property accessor to check- Returns:
- Name to use if found; null if not.
-
findNameForDeserialization
public PropertyName findNameForDeserialization(Annotated a)
Description copied from class:AnnotationIntrospectorMethod for checking whether given property accessors (method, field) has an annotation that suggests property name to use for deserialization (reading JSON into POJOs). Should return null if no annotation is found; otherwise a non-null name (possiblyPropertyName.USE_DEFAULT, which means "use default heuristics").- Overrides:
findNameForDeserializationin classJacksonAnnotationIntrospector- Parameters:
a- Annotated entity to check- Returns:
- Name to use if found;
nullif not.
-
-