Class JaxbAnnotationModule
- java.lang.Object
-
- com.fasterxml.jackson.databind.Module
-
- com.fasterxml.jackson.module.jaxb.JaxbAnnotationModule
-
- All Implemented Interfaces:
com.fasterxml.jackson.core.Versioned
public class JaxbAnnotationModule extends com.fasterxml.jackson.databind.Module
Module that can be registered to add support for JAXB annotations. It does basically equivalent ofobjectMapper.setAnnotationIntrospector(...);
with combination ofJaxbAnnotationIntrospector
and existing default introspector(s) (if any), depending on configuration (by default, JAXB annotations are used asJaxbAnnotationModule.Priority.PRIMARY
annotations).
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
JaxbAnnotationModule.Priority
Enumeration that defines how we use JAXB Annotations: either as "primary" annotations (before any other already configured introspector -- most likely default JacksonAnnotationIntrospector) or as "secondary" annotations (after any other already configured introspector(s)).
-
Field Summary
Fields Modifier and Type Field Description protected JaxbAnnotationIntrospector
_introspector
If the introspector is explicitly set or passed, we'll hold on to that until registration.protected com.fasterxml.jackson.annotation.JsonInclude.Include
_nonNillableInclusion
Value to pass toJaxbAnnotationIntrospector.setNonNillableInclusion(com.fasterxml.jackson.annotation.JsonInclude.Include)
if defined and non-null.protected JaxbAnnotationModule.Priority
_priority
Priority to use when registering annotation introspector: default value isJaxbAnnotationModule.Priority.PRIMARY
.
-
Constructor Summary
Constructors Constructor Description JaxbAnnotationModule()
JaxbAnnotationModule(JaxbAnnotationIntrospector intr)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
getModuleName()
com.fasterxml.jackson.annotation.JsonInclude.Include
getNonNillableInclusion()
JaxbAnnotationModule.Priority
getPriority()
JaxbAnnotationModule
setNonNillableInclusion(com.fasterxml.jackson.annotation.JsonInclude.Include incl)
JaxbAnnotationModule
setPriority(JaxbAnnotationModule.Priority p)
Method for defining whether JAXB annotations should be added as primary or secondary annotations (compared to already registered annotations).void
setupModule(com.fasterxml.jackson.databind.Module.SetupContext context)
com.fasterxml.jackson.core.Version
version()
-
-
-
Field Detail
-
_priority
protected JaxbAnnotationModule.Priority _priority
Priority to use when registering annotation introspector: default value isJaxbAnnotationModule.Priority.PRIMARY
.
-
_introspector
protected JaxbAnnotationIntrospector _introspector
If the introspector is explicitly set or passed, we'll hold on to that until registration.- Since:
- 2.7
-
_nonNillableInclusion
protected com.fasterxml.jackson.annotation.JsonInclude.Include _nonNillableInclusion
Value to pass toJaxbAnnotationIntrospector.setNonNillableInclusion(com.fasterxml.jackson.annotation.JsonInclude.Include)
if defined and non-null.- Since:
- 2.7
-
-
Constructor Detail
-
JaxbAnnotationModule
public JaxbAnnotationModule()
-
JaxbAnnotationModule
public JaxbAnnotationModule(JaxbAnnotationIntrospector intr)
- Since:
- 2.7
-
-
Method Detail
-
getModuleName
public java.lang.String getModuleName()
- Specified by:
getModuleName
in classcom.fasterxml.jackson.databind.Module
-
version
public com.fasterxml.jackson.core.Version version()
- Specified by:
version
in interfacecom.fasterxml.jackson.core.Versioned
- Specified by:
version
in classcom.fasterxml.jackson.databind.Module
-
setupModule
public void setupModule(com.fasterxml.jackson.databind.Module.SetupContext context)
- Specified by:
setupModule
in classcom.fasterxml.jackson.databind.Module
-
setPriority
public JaxbAnnotationModule setPriority(JaxbAnnotationModule.Priority p)
Method for defining whether JAXB annotations should be added as primary or secondary annotations (compared to already registered annotations).NOTE: method MUST be called before registering the module -- calling afterwards will not have any effect on previous registrations.
-
getPriority
public JaxbAnnotationModule.Priority getPriority()
-
setNonNillableInclusion
public JaxbAnnotationModule setNonNillableInclusion(com.fasterxml.jackson.annotation.JsonInclude.Include incl)
- Since:
- 2.7
-
getNonNillableInclusion
public com.fasterxml.jackson.annotation.JsonInclude.Include getNonNillableInclusion()
- Since:
- 2.7
-
-