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,Serializable
public class JacksonXmlAnnotationIntrospector
extends JacksonAnnotationIntrospector
implements XmlAnnotationIntrospector
Extension of
JacksonAnnotationIntrospector that 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,
class com.fasterxml.jackson.module.jaxb.JaxbAnnotationIntrospector).- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class com.fasterxml.jackson.databind.AnnotationIntrospector
AnnotationIntrospector.ReferenceProperty, AnnotationIntrospector.XmlExtensionsNested classes/interfaces inherited from interface com.fasterxml.jackson.dataformat.xml.XmlAnnotationIntrospector
XmlAnnotationIntrospector.Pair -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final booleanFor backwards compatibility with 2.0, the default behavior is to assume use of List wrapper if no annotations are used. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidfindAndAddVirtualProperties(MapperConfig<?> config, AnnotatedClass ac, List<BeanPropertyWriter> properties) Due to issue [dataformat-xml#578] need to suppress calls to this method to avoid duplicate virtual properties from being added.Method for checking whether given property accessors (method, field) has an annotation that suggests property name to use for deserialization (reading JSON into POJOs).Method for checking whether given property accessors (method, field) has an annotation that suggests property name to use for serialization.findNamespace(MapperConfig<?> config, Annotated ann) Method that can be called to figure out generic namespace property for an annotated object.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.findWrapperName(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.isOutputAsAttribute(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)isOutputAsCData(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.isOutputAsText(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, versionMethods inherited from class com.fasterxml.jackson.databind.AnnotationIntrospector
allIntrospectors, allIntrospectors, nopInstance, pair
-
Field Details
-
DEFAULT_USE_WRAPPER
public static final boolean DEFAULT_USE_WRAPPERFor backwards compatibility with 2.0, the default behavior is to assume use of List wrapper if no annotations are used.- See Also:
-
-
Constructor Details
-
JacksonXmlAnnotationIntrospector
public JacksonXmlAnnotationIntrospector() -
JacksonXmlAnnotationIntrospector
public JacksonXmlAnnotationIntrospector(boolean defaultUseWrapper)
-
-
Method Details
-
setDefaultUseWrapper
public void setDefaultUseWrapper(boolean b) -
findWrapperName
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
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
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, 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
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
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
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
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
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.
-