Examples of AnnotationIntrospector


Examples of org.codehaus.jackson.map.AnnotationIntrospector

        }
    }

    private ObjectMapper getMapper() {
        ObjectMapper jacksonMapper = new ObjectMapper();
        AnnotationIntrospector primary = new JacksonAnnotationIntrospector();
        jacksonMapper.setAnnotationIntrospector(primary);
        jacksonMapper.configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false);
        jacksonMapper.registerModule(new MrBeanModule());
        return jacksonMapper;
    }
View Full Code Here

Examples of org.codehaus.jackson.map.AnnotationIntrospector

    }


    private static Pair createJaxbJacksonAnnotationIntrospector() {

        AnnotationIntrospector jaxbIntrospector = new JaxbAnnotationIntrospector();
        AnnotationIntrospector jacksonIntrospector = new JacksonAnnotationIntrospector();

        return new AnnotationIntrospector.Pair(jaxbIntrospector, jacksonIntrospector);
    }
View Full Code Here

Examples of org.codehaus.jackson.map.AnnotationIntrospector

                        }
                    }
                }
            }
        }
        AnnotationIntrospector primary = new JaxbAnnotationIntrospector();
        AnnotationIntrospector secondary = new JacksonAnnotationIntrospector();
        AnnotationIntrospector pair = new AnnotationIntrospector.Pair(primary, secondary);
        mapper.getDeserializationConfig().setAnnotationIntrospector(pair);
        // [rfeng] To avoid complaints about javaClass
        mapper.getDeserializationConfig().set(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, Boolean.FALSE);
        mapper.getSerializationConfig().setAnnotationIntrospector(pair);
        return mapper;
View Full Code Here

Examples of org.codehaus.jackson.map.AnnotationIntrospector

            }
        }
        if (mapper == null) {
            mapper = new ObjectMapper();
        }
        AnnotationIntrospector primary = new JaxbAnnotationIntrospector();
        AnnotationIntrospector secondary = new JacksonAnnotationIntrospector();
        AnnotationIntrospector pair = new AnnotationIntrospector.Pair(primary, secondary);
        mapper.getDeserializationConfig().setAnnotationIntrospector(pair);
        // [rfeng] To avoid complaints about javaClass
        mapper.getDeserializationConfig().set(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, Boolean.FALSE);
        mapper.getSerializationConfig().setAnnotationIntrospector(pair);
        mapper.getSerializationConfig().setSerializationInclusion(JsonSerialize.Inclusion.NON_NULL);
View Full Code Here

Examples of org.codehaus.jackson.map.AnnotationIntrospector

public class JacksonConfig implements ContextResolver<ObjectMapper> {
    private final ObjectMapper mapper;

    public JacksonConfig() {
        mapper = new ObjectMapper();
        AnnotationIntrospector primary = new JaxbAnnotationIntrospector();
        AnnotationIntrospector secondary = new JacksonAnnotationIntrospector();
        AnnotationIntrospector introspectorPair = new AnnotationIntrospector.Pair(primary, secondary);
        mapper.setDeserializationConfig(mapper.getDeserializationConfig().withAnnotationIntrospector(introspectorPair));
        mapper.setSerializationConfig(mapper.getSerializationConfig().withAnnotationIntrospector(introspectorPair));
    }
View Full Code Here

Examples of org.codehaus.jackson.map.AnnotationIntrospector

            if (name != null) {
                return name;
            }
        }
        BasicBeanDescription beanDesc = (BasicBeanDescription) config.introspectClassAnnotations(rootType);
        AnnotationIntrospector intr = config.getAnnotationIntrospector();
        AnnotatedClass ac = beanDesc.getClassInfo();
        String nameStr = intr.findRootName(ac);
        // No answer so far? Let's just default to using simple class name
        if (nameStr == null) {
            // Should we strip out enclosing class tho? For now, nope:
            nameStr = rootType.getSimpleName();
        }
View Full Code Here

Examples of org.codehaus.jackson.map.AnnotationIntrospector

    @Override
    public BasicBeanDescription forClassAnnotations(MapperConfig<?> cfg,
            JavaType type, MixInResolver r)
    {
        boolean useAnnotations = cfg.isAnnotationProcessingEnabled();
        AnnotationIntrospector ai =  cfg.getAnnotationIntrospector();
        AnnotatedClass ac = AnnotatedClass.construct(type.getRawClass(), (useAnnotations ? ai : null), r);
        return BasicBeanDescription.forOtherUse(cfg, type, ac);
    }
View Full Code Here

Examples of org.codehaus.jackson.map.AnnotationIntrospector

    @Override
    public BasicBeanDescription forDirectClassAnnotations(MapperConfig<?> cfg,
            JavaType type, MixInResolver r)
    {
        boolean useAnnotations = cfg.isAnnotationProcessingEnabled();
        AnnotationIntrospector ai =  cfg.getAnnotationIntrospector();
        AnnotatedClass ac = AnnotatedClass.constructWithoutSuperTypes(type.getRawClass(),
                (useAnnotations ? ai : null), r);
        return BasicBeanDescription.forOtherUse(cfg, type, ac);
    }
View Full Code Here

Examples of org.codehaus.jackson.map.AnnotationIntrospector

     */
    public AnnotatedClass classWithCreators(MapperConfig<?> config,
            JavaType type, MixInResolver r)
    {
        boolean useAnnotations = config.isAnnotationProcessingEnabled();
        AnnotationIntrospector ai = config.getAnnotationIntrospector();
        AnnotatedClass ac = AnnotatedClass.construct(type.getRawClass(), (useAnnotations ? ai : null), r);
        ac.resolveMemberMethods(MINIMAL_FILTER);
        // true -> include all creators, not just default constructor
        ac.resolveCreators(true);
        return ac;
View Full Code Here

Examples of org.codehaus.jackson.map.AnnotationIntrospector

* for properties annotated with Spring format annotations such as @DateTimeFormat and @NumberFormat.
*/
public class ConversionServiceAwareObjectMapper extends ObjectMapper {
  @Autowired
  public ConversionServiceAwareObjectMapper(ConversionService conversionService) {
    AnnotationIntrospector introspector = AnnotationIntrospector.pair(new FormatAnnotationIntrospector(conversionService), DEFAULT_ANNOTATION_INTROSPECTOR);
    SerializationConfig sconfig = new SerializationConfig(DEFAULT_INTROSPECTOR, introspector, Std.defaultInstance(), null);
    DeserializationConfig dconfig = new DeserializationConfig(DEFAULT_INTROSPECTOR, introspector, Std.defaultInstance(), null);
    setSerializationConfig(sconfig);
    setDeserializationConfig(dconfig);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.