Top Description Fields Constructors Methods
tools.jackson.module.jakarta.xmlbind

public Class JakartaXmlBindAnnotationIntrospector

extends AnnotationIntrospector
implements XmlExtensions, Versioned
Class Inheritance
All Implemented Interfaces
tools.jackson.core.Versioned, tools.jackson.databind.AnnotationIntrospector.XmlExtensions
Imports
java.lang.annotation.Annotation, java.lang.reflect.*, java.util.*, jakarta.xml.bind.JAXBElement, jakarta.xml.bind.annotation.*, jakarta.xml.bind.annotation.adapters.XmlAdapter, .XmlJavaTypeAdapter, .XmlJavaTypeAdapters, com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility, com.fasterxml.jackson.annotation.*, tools.jackson.core.*, tools.jackson.databind.*, tools.jackson.databind.cfg.MapperConfig, tools.jackson.databind.introspect.*, tools.jackson.databind.jsontype.NamedType, tools.jackson.databind.type.TypeFactory, tools.jackson.databind.util.ClassUtil, .Converter, tools.jackson.module.jakarta.xmlbind.deser.DataHandlerDeserializer, tools.jackson.module.jakarta.xmlbind.ser.DataHandlerSerializer

Annotation introspector that uses Jakarta Xml Bind annotations (nee "JAXB" Annotations") where applicable for jackson-databind to use. As of Jackson 2.x, majority of XmlBind annotations are supported to some degree. Ones that are NOT yet supported are: Note also the following limitations:

Field Summary

Modifier and TypeField and Description
protected final ValueDeserializer<?>
protected final ValueSerializer<?>
protected final boolean
protected final String
protected JsonInclude.Include
_nonNillableInclusion

Inclusion value to return for properties annotated with XmlElement and XmlElementWrapper, in case nillable property is left as false.

protected String
_xmlValueName

When using XmlValue annotation, a placeholder name is assigned to property (unless overridden by explicit name); this configuration value specified what that name is.

protected static final boolean
protected static final String
protected static final JsonFormat.Value
protected static final JsonFormat.Value
protected static final String
private static final long

Constructor Summary

AccessConstructor and Description
public
public
JakartaXmlBindAnnotationIntrospector(boolean
Whether XmlIDREF annotation should be processed JAXB style (meaning that references are always serialized using id), or not (first reference as full POJO, others as ids)
ignoreXmlIDREF
)

Method Summary

Modifier and TypeMethod and Description
private static PropertyName
_combineNames(String localName, String namespace, String defaultName)

protected Converter<Object, Object>
_converter(MapperConfig<?> config, XmlAdapter<?, ?> adapter, boolean forSerialization)

protected String
protected Class<?>
private final Boolean
protected XmlAdapter<?, ?>
_findContentAdapter(MapperConfig<?> config, Annotated ann, boolean forSerialization)

protected JavaType
protected JavaType
protected Class<?>
protected String
protected String
protected String
protected Class<?>
protected Class<?>
pack-priv JsonInclude.Include
protected String
_stdManglePropertyName(final String basename, final int offset)

private boolean
adapterTypeMatches(MapperConfig<?> config, XmlAdapter<?, ?> adapter, Class<?> targetType)

private final XmlAdapter<Object, Object>
checkAdapter(MapperConfig<?> config, XmlJavaTypeAdapter adapterInfo, Class<?> typeNeeded, boolean forSerialization)

protected XmlAccessType
findAccessType(Annotated ac)

Method for locating JAXB XmlAccessType annotation value for given annotated entity, if it has one, or inherits one from its ancestors (in JAXB sense, package etc).

private XmlAdapter<Object, Object>

Returns:

The adapter, or null if none.
findAdapter
(MapperConfig<?> config, Annotated
The annotated element.
am
,
boolean
If true, adapter for serialization; if false, for deserialization
forSerialization
,
Class<?> type)

Finds the XmlAdapter for the specified annotation.

private XmlAdapter<Object, Object>
findAdapterForClass(AnnotatedClass ac, boolean forSerialization)

private <A extends Annotation> A

Returns:

The annotation, or null if not found.
findAnnotation
(Class<A>
the annotation class.
annotationClass
,
Annotated
The annotated element.
annotated
,
boolean
Whether the annotation can be found on the package of the annotated element.
includePackage
,
boolean
Whether the annotation can be found on the class of the annotated element.
includeClass
,
boolean
Whether the annotation can be found on any superclasses of the class of the annotated element.
includeSuperclasses
)

Finds an annotation associated with given annotatable thing; or if not found, a default annotation it may have (from super class, package and so on)

public VisibilityChecker
findAutoDetectVisibility(MapperConfig<?> config, AnnotatedClass ac, VisibilityChecker checker)

Overrides tools.jackson.databind.AnnotationIntrospector.findAutoDetectVisibility.

Method for checking if annotations indicate changes to minimum visibility levels needed for auto-detecting property elements (fields, methods, constructors).

public Object
findContentDeserializer(MapperConfig<?> config, Annotated a)

Overrides tools.jackson.databind.AnnotationIntrospector.findContentDeserializer.

Method for getting a deserializer definition for content (values) of associated Collection, array or Map property.

public Object
findContentSerializer(MapperConfig<?> config, Annotated a)

Overrides tools.jackson.databind.AnnotationIntrospector.findContentSerializer.

Method for getting a serializer definition for content (values) of associated Collection, array or Map property.

public Object
findDeserializationContentConverter(MapperConfig<?> config, AnnotatedMember a)

Overrides tools.jackson.databind.AnnotationIntrospector.findDeserializationContentConverter.

Method for finding Converter that annotated property has indicated needs to be used for values of container type (this also means that method should only be called for properties of container types, List/Map/array properties).

public Object
findDeserializationConverter(MapperConfig<?> config, Annotated a)

Overrides tools.jackson.databind.AnnotationIntrospector.findDeserializationConverter.

Method for finding Converter that annotated entity (property or class) has indicated to be used as part of deserialization.

public Object
findDeserializer(MapperConfig<?> config, Annotated am)

Overrides tools.jackson.databind.AnnotationIntrospector.findDeserializer.

Method for getting a deserializer definition on specified method or field.

public String[]
findEnumValues(MapperConfig<?> config, AnnotatedClass annotatedClass, Enum<?>[] enumValues, String[] names)

Overrides tools.jackson.databind.AnnotationIntrospector.findEnumValues.

Finds the explicitly defined name of the given set of Enum values, if any.

public JsonFormat.Value
findFormat(MapperConfig<?> config, Annotated m)

Overrides tools.jackson.databind.AnnotationIntrospector.findFormat.

Method for finding format annotations for property or class.

public String
findImplicitPropertyName(MapperConfig<?> config, AnnotatedMember m)

Overrides tools.jackson.databind.AnnotationIntrospector.findImplicitPropertyName.

Method for finding implicit name for a property that given annotated member (field, method, creator parameter) may represent.

private PropertyName
findJaxbPropertyName(Annotated ae, Class<?> aeType, String defaultName)

public Object
findKeyDeserializer(MapperConfig<?> config, Annotated am)

Overrides tools.jackson.databind.AnnotationIntrospector.findKeyDeserializer.

Method for getting a deserializer definition for keys of associated Map property.

public PropertyName
findNameForDeserialization(MapperConfig<?> config, Annotated a)

Overrides tools.jackson.databind.AnnotationIntrospector.findNameForDeserialization.

Method for checking whether given property accessors (method, field) has an annotation that suggests property name to use for deserialization (reading JSON into POJOs).

public PropertyName
findNameForSerialization(MapperConfig<?> config, Annotated a)

Overrides tools.jackson.databind.AnnotationIntrospector.findNameForSerialization.

Method for checking whether given property accessors (method, field) has an annotation that suggests property name to use for serialization.

public String
findNamespace(MapperConfig<?> config, Annotated ann)

Implements tools.jackson.databind.AnnotationIntrospector.XmlExtensions.findNamespace.

Method that can be called to figure out generic namespace property for an annotated object.

public ObjectIdInfo
findObjectIdInfo(MapperConfig<?> config, Annotated ann)

Overrides tools.jackson.databind.AnnotationIntrospector.findObjectIdInfo.

Method for checking whether given annotated thing (type, or accessor) indicates that values referenced (values of type of annotated class, or values referenced by annotated property; latter having precedence) should include Object Identifier, and if so, specify details of Object Identity used.

public ObjectIdInfo
findObjectReferenceInfo(MapperConfig<?> config, Annotated ann, ObjectIdInfo base)

Overrides tools.jackson.databind.AnnotationIntrospector.findObjectReferenceInfo.

Method for figuring out additional properties of an Object Identity reference

public JsonTypeInfo.Value
findPolymorphicTypeInfo(MapperConfig<?> config, Annotated ann)

Overrides tools.jackson.databind.AnnotationIntrospector.findPolymorphicTypeInfo.

Method for checking whether given Class or Property Accessor specifies polymorphic type-handling information, to indicate need for polymorphic handling.

public JsonInclude.Value
findPropertyInclusion(MapperConfig<?> config, Annotated a)

Overrides tools.jackson.databind.AnnotationIntrospector.findPropertyInclusion.

Method for checking inclusion criteria for a type (Class) or property (yes, method name is bit unfortunate -- not just for properties!).

private XmlRootElement
public PropertyName
findRootName(MapperConfig<?> config, AnnotatedClass ac)

Overrides tools.jackson.databind.AnnotationIntrospector.findRootName.

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.

public Object
findSerializationContentConverter(MapperConfig<?> config, AnnotatedMember a)

Overrides tools.jackson.databind.AnnotationIntrospector.findSerializationContentConverter.

Method for finding Converter that annotated property has indicated needs to be used for values of container type (this also means that method should only be called for properties of container types, List/Map/array properties).

public Object
findSerializationConverter(MapperConfig<?> config, Annotated a)

Overrides tools.jackson.databind.AnnotationIntrospector.findSerializationConverter.

Method for finding Converter that annotated entity (property or class) has indicated to be used as part of serialization.

public String[]
findSerializationPropertyOrder(MapperConfig<?> config, AnnotatedClass ac)

Overrides tools.jackson.databind.AnnotationIntrospector.findSerializationPropertyOrder.

Method for accessing defined property serialization order (which may be partial).

public Boolean
findSerializationSortAlphabetically(MapperConfig<?> config, Annotated ann)

Overrides tools.jackson.databind.AnnotationIntrospector.findSerializationSortAlphabetically.

Method for checking whether an annotation indicates that serialized properties for which no explicit is defined should be alphabetically (lexicograpically) ordered

public ValueSerializer<?>
findSerializer(MapperConfig<?> config, Annotated am)

Overrides tools.jackson.databind.AnnotationIntrospector.findSerializer.

Method for getting a serializer definition on specified method or field.

public List<NamedType>
findSubtypes(MapperConfig<?> config, Annotated a)

Overrides tools.jackson.databind.AnnotationIntrospector.findSubtypes.

Method for locating annotation-specified subtypes related to annotated entity (class, method, field).

public String
findTypeName(MapperConfig<?> config, AnnotatedClass ac)

Overrides tools.jackson.databind.AnnotationIntrospector.findTypeName.

Method for checking if specified type has explicit name.

public PropertyName
findWrapperName(MapperConfig<?> config, Annotated ann)

Overrides tools.jackson.databind.AnnotationIntrospector.findWrapperName.

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.

public String
getNameUsedForXmlValue()

Accessor for getting currently configured placeholder named used for property annotated with XmlValue.

public JsonInclude.Include
public boolean
hasIgnoreMarker(MapperConfig<?> config, AnnotatedMember m)

Overrides tools.jackson.databind.AnnotationIntrospector.hasIgnoreMarker.

Method called to check whether given property is marked to be ignored.

public Boolean
hasRequiredMarker(MapperConfig<?> config, AnnotatedMember m)

Overrides tools.jackson.databind.AnnotationIntrospector.hasRequiredMarker.

Method that can be called to check whether this member has an annotation that suggests whether value for matching property is required or not.

private boolean
isContainerType(Class<?> raw)

Helper method used to distinguish structured types (arrays, Lists, Maps), which with JAXB use different rules for defining content types.

private boolean

Returns:

Whether the type is assignable to class jakarta.activation.DataHandler
isDataHandler
(Class<?>
The type.
type
)

Determines whether the type is assignable to class jakarta.activation.DataHandler without requiring that class to be on the classpath.

public Boolean
isIgnorableType(MapperConfig<?> config, AnnotatedClass ac)

Overrides tools.jackson.databind.AnnotationIntrospector.isIgnorableType.

Method for checking whether properties that have specified type (class, not generics aware) should be completely ignored for serialization and deserialization purposes.

protected boolean

Returns:

Whether the annotation is in the JAXB package.
isJAXBAnnotation
(Annotation
The annotation.
ann
)

An annotation is handled if it's in the same package as @XmlElement, including subpackages.

public Boolean
isOutputAsAttribute(MapperConfig<?> config, Annotated ann)

Implements tools.jackson.databind.AnnotationIntrospector.XmlExtensions.isOutputAsAttribute.

Here we assume fairly simple logic; if there is XmlAttribute to be found, we consider it an attribute; if XmlElement, not-an-attribute; and otherwise we will consider there to be no information.

public Boolean
isOutputAsCData(MapperConfig<?> config, Annotated ann)

Implements tools.jackson.databind.AnnotationIntrospector.XmlExtensions.isOutputAsCData.

Method used to check whether given annotated element (field, method, constructor parameter) has indicator that suggests it should be wrapped in a CDATA tag.

public Boolean
isOutputAsText(MapperConfig<?> config, Annotated ann)

Implements tools.jackson.databind.AnnotationIntrospector.XmlExtensions.isOutputAsText.

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.

private boolean

Returns:

Whether the field is invisible.
isVisible
(AnnotatedField
The field.
f
)

Whether the specified field is invisible, per the JAXB visibility rules.

private boolean
public JavaType
refineDeserializationType(final MapperConfig<?> config, final Annotated a, final JavaType baseType)

Overrides tools.jackson.databind.AnnotationIntrospector.refineDeserializationType.

Method called to find out possible type refinements to use for deserialization.

public JavaType
refineSerializationType(final MapperConfig<?> config, final Annotated a, final JavaType baseType)

Overrides tools.jackson.databind.AnnotationIntrospector.refineSerializationType.

Method called to find out possible type refinements to use for deserialization, including not just value itself but key and/or content type, if type has those.

public void
setNameUsedForXmlValue(String name)

Configuration method that can be used to change default name ("value") used for properties annotated with XmlValue; note that setting it to null will actually avoid name override, and name will instead be derived from underlying method name using standard bean name introspection.

public JakartaXmlBindAnnotationIntrospector
setNonNillableInclusion(JsonInclude.Include incl)

Method to call to change inclusion criteria used for property annotated with XmlElement or XmlElementWrapper, with nillable set as false.

public Version
version()

Implements abstract tools.jackson.databind.AnnotationIntrospector.version.

Implements tools.jackson.core.Versioned.version.

Method that will return version information stored in and read from jar that contains this class.

Inherited from tools.jackson.databind.AnnotationIntrospector:
_findAnnotation_hasAnnotation_hasOneOfallIntrospectorsallIntrospectorsfindAndAddVirtualPropertiesfindClassDescriptionfindCreatorAnnotationfindDefaultEnumValuefindEnumAliasesfindEnumNamingStrategyfindFilterIdfindInjectableValuefindKeySerializerfindMergeInfofindNamingStrategyfindNullSerializerfindPOJOBuilderfindPOJOBuilderConfigfindPreferredCreatorfindPropertyAccessfindPropertyAliasesfindPropertyDefaultValuefindPropertyDescriptionfindPropertyIgnoralByNamefindPropertyInclusionByNamefindPropertyIndexfindReferenceTypefindRenameByFieldfindSerializationTypingfindSetterInfofindTypeIdResolverfindTypeResolverBuilderfindUnwrappingNameTransformerfindValueInstantiatorfindViewshasAnyGetterhasAnySetterhasAsKeyhasAsValueisAnnotationBundleisTypeIdnopInstancepairresolveSetterConflict