Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package com.fasterxml.jackson.module.jaxb;
 
Module that can be registered to add support for JAXB annotations. It does basically equivalent of
   objectMapper.setAnnotationIntrospector(...);
with combination of JaxbAnnotationIntrospector and existing default introspector(s) (if any), depending on configuration (by default, JAXB annotations are used as JaxbAnnotationModule.Priority.PRIMARY annotations).
public class JaxbAnnotationModule extends SimpleModule
{
    
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)).

Default choice is PRIMARY

Note that if you want to use JAXB annotations as the only annotations, you must directly set annotation introspector by calling com.fasterxml.jackson.databind.ObjectMapper.setAnnotationIntrospector(com.fasterxml.jackson.databind.AnnotationIntrospector).

    public enum Priority {
        PRIMARY, SECONDARY;
    }
    
    
Priority to use when registering annotation introspector: default value is JaxbAnnotationModule.Priority.PRIMARY.
    protected Priority _priority = .;
    /*
    /**********************************************************
    /* Life cycle
    /**********************************************************
     */
    
    public JaxbAnnotationModule()
    {
        super("jaxb-annotations"..version());
    }
    
    @Override
    public void setupModule(SetupContext context)
    {
        switch () {
        case :
            context.insertAnnotationIntrospector(intr);
            break;
        case :
            context.appendAnnotationIntrospector(intr);
            break;
        }
    }
    /*
    /**********************************************************
    /* Configuration
    /**********************************************************
     */
    
    
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.

         = p;
        return this;
    }
    
    public Priority getPriority() { return ; }
New to GrepCode? Check out our FAQ X