Search in sources :

Example 1 with AnnotationIntrospector

use of org.codehaus.jackson.map.AnnotationIntrospector in project jersey by jersey.

the class MyObjectMapperProvider method createJaxbJacksonAnnotationIntrospector.

private static Pair createJaxbJacksonAnnotationIntrospector() {
    final AnnotationIntrospector jaxbIntrospector = new JaxbAnnotationIntrospector();
    final AnnotationIntrospector jacksonIntrospector = new JacksonAnnotationIntrospector();
    return new AnnotationIntrospector.Pair(jacksonIntrospector, jaxbIntrospector);
}
Also used : JacksonAnnotationIntrospector(org.codehaus.jackson.map.introspect.JacksonAnnotationIntrospector) JacksonAnnotationIntrospector(org.codehaus.jackson.map.introspect.JacksonAnnotationIntrospector) JaxbAnnotationIntrospector(org.codehaus.jackson.xc.JaxbAnnotationIntrospector) AnnotationIntrospector(org.codehaus.jackson.map.AnnotationIntrospector) JaxbAnnotationIntrospector(org.codehaus.jackson.xc.JaxbAnnotationIntrospector) Pair(org.codehaus.jackson.map.AnnotationIntrospector.Pair)

Example 2 with AnnotationIntrospector

use of org.codehaus.jackson.map.AnnotationIntrospector in project opennms by OpenNMS.

the class JacksonUtils method createDefaultObjectMapper.

public static ObjectMapper createDefaultObjectMapper() {
    final ObjectMapper mapper = new ObjectMapper();
    final AnnotationIntrospector introspectorPair = AnnotationIntrospector.pair(new JacksonAnnotationIntrospector(), new JaxbAnnotationIntrospector());
    mapper.setDeserializationConfig(mapper.getDeserializationConfig().withAnnotationIntrospector(introspectorPair));
    mapper.setSerializationConfig(mapper.getSerializationConfig().withAnnotationIntrospector(introspectorPair));
    return mapper;
}
Also used : JacksonAnnotationIntrospector(org.codehaus.jackson.map.introspect.JacksonAnnotationIntrospector) JacksonAnnotationIntrospector(org.codehaus.jackson.map.introspect.JacksonAnnotationIntrospector) JaxbAnnotationIntrospector(org.codehaus.jackson.xc.JaxbAnnotationIntrospector) AnnotationIntrospector(org.codehaus.jackson.map.AnnotationIntrospector) ObjectMapper(org.codehaus.jackson.map.ObjectMapper) JaxbAnnotationIntrospector(org.codehaus.jackson.xc.JaxbAnnotationIntrospector)

Example 3 with AnnotationIntrospector

use of org.codehaus.jackson.map.AnnotationIntrospector in project zm-mailbox by Zimbra.

the class ZimbraBeanSerializerModifier method changeProperties.

/*
    /**********************************************************
    /* Overridden methods
    /**********************************************************
     */
/**
     * First thing to do is to find annotations regarding XML serialization,
     * and wrap collection serializers.
     */
@Override
public List<BeanPropertyWriter> changeProperties(SerializationConfig config, BasicBeanDescription beanDesc, List<BeanPropertyWriter> beanProperties) {
    AnnotationIntrospector intr = config.getAnnotationIntrospector();
    for (int i = 0, len = beanProperties.size(); i < len; ++i) {
        BeanPropertyWriter bpw = beanProperties.get(i);
        final AnnotatedMember member = bpw.getMember();
        NameInfo nameInfo = new NameInfo(intr, member, bpw.getName());
        if (!nameInfo.needSpecialHandling()) {
            continue;
        }
        beanProperties.set(i, new ZimbraBeanPropertyWriter(bpw, nameInfo));
    }
    return beanProperties;
}
Also used : AnnotationIntrospector(org.codehaus.jackson.map.AnnotationIntrospector) AnnotatedMember(org.codehaus.jackson.map.introspect.AnnotatedMember) BeanPropertyWriter(org.codehaus.jackson.map.ser.BeanPropertyWriter)

Example 4 with AnnotationIntrospector

use of org.codehaus.jackson.map.AnnotationIntrospector in project oxAuth by GluuFederation.

the class ServerUtil method createJsonMapper.

public static ObjectMapper createJsonMapper() {
    final AnnotationIntrospector jaxb = new JaxbAnnotationIntrospector();
    final AnnotationIntrospector jackson = new JacksonAnnotationIntrospector();
    final AnnotationIntrospector pair = new AnnotationIntrospector.Pair(jackson, jaxb);
    final ObjectMapper mapper = new ObjectMapper();
    mapper.getDeserializationConfig().withAnnotationIntrospector(pair);
    mapper.getSerializationConfig().withAnnotationIntrospector(pair);
    return mapper;
}
Also used : JacksonAnnotationIntrospector(org.codehaus.jackson.map.introspect.JacksonAnnotationIntrospector) JacksonAnnotationIntrospector(org.codehaus.jackson.map.introspect.JacksonAnnotationIntrospector) JaxbAnnotationIntrospector(org.codehaus.jackson.xc.JaxbAnnotationIntrospector) AnnotationIntrospector(org.codehaus.jackson.map.AnnotationIntrospector) JaxbAnnotationIntrospector(org.codehaus.jackson.xc.JaxbAnnotationIntrospector) ObjectMapper(org.codehaus.jackson.map.ObjectMapper)

Example 5 with AnnotationIntrospector

use of org.codehaus.jackson.map.AnnotationIntrospector in project oxCore by GluuFederation.

the class Util method createJsonMapper.

/**
     * Creates json mapper.
     *
     * @return json mapper
     */
public static ObjectMapper createJsonMapper() {
    final AnnotationIntrospector jaxb = new JaxbAnnotationIntrospector();
    final AnnotationIntrospector jackson = new JacksonAnnotationIntrospector();
    final AnnotationIntrospector pair = new AnnotationIntrospector.Pair(jackson, jaxb);
    final ObjectMapper mapper = new ObjectMapper();
    mapper.getDeserializationConfig().withAnnotationIntrospector(pair);
    mapper.getSerializationConfig().withAnnotationIntrospector(pair);
    return mapper;
}
Also used : JacksonAnnotationIntrospector(org.codehaus.jackson.map.introspect.JacksonAnnotationIntrospector) JaxbAnnotationIntrospector(org.codehaus.jackson.xc.JaxbAnnotationIntrospector) AnnotationIntrospector(org.codehaus.jackson.map.AnnotationIntrospector) JacksonAnnotationIntrospector(org.codehaus.jackson.map.introspect.JacksonAnnotationIntrospector) JaxbAnnotationIntrospector(org.codehaus.jackson.xc.JaxbAnnotationIntrospector) ObjectMapper(org.codehaus.jackson.map.ObjectMapper)

Aggregations

AnnotationIntrospector (org.codehaus.jackson.map.AnnotationIntrospector)5 JacksonAnnotationIntrospector (org.codehaus.jackson.map.introspect.JacksonAnnotationIntrospector)4 JaxbAnnotationIntrospector (org.codehaus.jackson.xc.JaxbAnnotationIntrospector)4 ObjectMapper (org.codehaus.jackson.map.ObjectMapper)3 Pair (org.codehaus.jackson.map.AnnotationIntrospector.Pair)1 AnnotatedMember (org.codehaus.jackson.map.introspect.AnnotatedMember)1 BeanPropertyWriter (org.codehaus.jackson.map.ser.BeanPropertyWriter)1