Search in sources :

Example 6 with AnnotationIntrospector

use of com.fasterxml.jackson.databind.AnnotationIntrospector in project jackson-databind by FasterXML.

the class ConcreteBeanPropertyBase method findAliases.

@Override
public List<PropertyName> findAliases(MapperConfig<?> config) {
    List<PropertyName> aliases = _aliases;
    if (aliases == null) {
        AnnotationIntrospector intr = config.getAnnotationIntrospector();
        if (intr != null) {
            aliases = intr.findPropertyAliases(getMember());
        }
        if (aliases == null) {
            aliases = Collections.emptyList();
        }
        _aliases = aliases;
    }
    return aliases;
}
Also used : PropertyName(com.fasterxml.jackson.databind.PropertyName) AnnotationIntrospector(com.fasterxml.jackson.databind.AnnotationIntrospector)

Example 7 with AnnotationIntrospector

use of com.fasterxml.jackson.databind.AnnotationIntrospector in project jackson-databind by FasterXML.

the class ConcreteBeanPropertyBase method findPropertyInclusion.

@Override
public JsonInclude.Value findPropertyInclusion(MapperConfig<?> config, Class<?> baseType) {
    JsonInclude.Value v0 = config.getDefaultPropertyInclusion(baseType);
    AnnotationIntrospector intr = config.getAnnotationIntrospector();
    AnnotatedMember member = getMember();
    if ((intr == null) || (member == null)) {
        return v0;
    }
    JsonInclude.Value v = intr.findPropertyInclusion(member);
    if (v0 == null) {
        return v;
    }
    return v0.withOverrides(v);
}
Also used : JsonInclude(com.fasterxml.jackson.annotation.JsonInclude) AnnotationIntrospector(com.fasterxml.jackson.databind.AnnotationIntrospector)

Example 8 with AnnotationIntrospector

use of com.fasterxml.jackson.databind.AnnotationIntrospector in project platformlayer by platformlayer.

the class JsonHelper method buildObjectMapper.

public static ObjectMapper buildObjectMapper(TypeFactory typeFactory, boolean formatted) {
    ObjectMapper mapper = new ObjectMapper();
    if (typeFactory == null) {
        typeFactory = TypeFactory.defaultInstance();
    }
    if (formatted) {
        mapper.enable(SerializationFeature.INDENT_OUTPUT);
    }
    // Favor JAXB annotations
    AnnotationIntrospector jaxbIntrospector = new JaxbAnnotationIntrospector(typeFactory);
    AnnotationIntrospector jacksonIntrospector = new JacksonAnnotationIntrospector();
    AnnotationIntrospector introspector = new AnnotationIntrospectorPair(jaxbIntrospector, jacksonIntrospector);
    mapper.setAnnotationIntrospector(introspector);
    return mapper;
}
Also used : JacksonAnnotationIntrospector(com.fasterxml.jackson.databind.introspect.JacksonAnnotationIntrospector) AnnotationIntrospectorPair(com.fasterxml.jackson.databind.introspect.AnnotationIntrospectorPair) JacksonAnnotationIntrospector(com.fasterxml.jackson.databind.introspect.JacksonAnnotationIntrospector) AnnotationIntrospector(com.fasterxml.jackson.databind.AnnotationIntrospector) JaxbAnnotationIntrospector(com.fasterxml.jackson.module.jaxb.JaxbAnnotationIntrospector) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) JaxbAnnotationIntrospector(com.fasterxml.jackson.module.jaxb.JaxbAnnotationIntrospector)

Example 9 with AnnotationIntrospector

use of com.fasterxml.jackson.databind.AnnotationIntrospector in project jackson-databind by FasterXML.

the class AnnotatedClass method construct.

/**
     * @since 2.7
     */
public static AnnotatedClass construct(JavaType type, MapperConfig<?> config, MixInResolver mir) {
    AnnotationIntrospector intr = config.isAnnotationProcessingEnabled() ? config.getAnnotationIntrospector() : null;
    Class<?> raw = type.getRawClass();
    return new AnnotatedClass(type, raw, type.getBindings(), ClassUtil.findSuperTypes(type, null, false), intr, mir, config.getTypeFactory());
}
Also used : AnnotationIntrospector(com.fasterxml.jackson.databind.AnnotationIntrospector)

Example 10 with AnnotationIntrospector

use of com.fasterxml.jackson.databind.AnnotationIntrospector in project jackson-databind by FasterXML.

the class AnnotatedClass method construct.

/**
     * Factory method that instantiates an instance. Returned instance
     * will only be initialized with class annotations, but not with
     * any method information.
     * 
     * @since 2.7
     */
public static AnnotatedClass construct(JavaType type, MapperConfig<?> config) {
    AnnotationIntrospector intr = config.isAnnotationProcessingEnabled() ? config.getAnnotationIntrospector() : null;
    Class<?> raw = type.getRawClass();
    return new AnnotatedClass(type, raw, type.getBindings(), ClassUtil.findSuperTypes(type, null, false), intr, (MixInResolver) config, config.getTypeFactory());
}
Also used : AnnotationIntrospector(com.fasterxml.jackson.databind.AnnotationIntrospector)

Aggregations

AnnotationIntrospector (com.fasterxml.jackson.databind.AnnotationIntrospector)14 NamedType (com.fasterxml.jackson.databind.jsontype.NamedType)4 JacksonAnnotationIntrospector (com.fasterxml.jackson.databind.introspect.JacksonAnnotationIntrospector)3 JaxbAnnotationIntrospector (com.fasterxml.jackson.module.jaxb.JaxbAnnotationIntrospector)3 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)2 JsonFormat (com.fasterxml.jackson.annotation.JsonFormat)1 JsonInclude (com.fasterxml.jackson.annotation.JsonInclude)1 PropertyName (com.fasterxml.jackson.databind.PropertyName)1 JsonPOJOBuilder (com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder)1 Annotated (com.fasterxml.jackson.databind.introspect.Annotated)1 AnnotatedClass (com.fasterxml.jackson.databind.introspect.AnnotatedClass)1 AnnotatedField (com.fasterxml.jackson.databind.introspect.AnnotatedField)1 AnnotatedMethod (com.fasterxml.jackson.databind.introspect.AnnotatedMethod)1 AnnotationIntrospectorPair (com.fasterxml.jackson.databind.introspect.AnnotationIntrospectorPair)1 Method (java.lang.reflect.Method)1