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;
}
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);
}
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;
}
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());
}
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());
}
Aggregations