Examples of JaxbAnnotationIntrospector


Examples of com.fasterxml.jackson.module.jaxb.JaxbAnnotationIntrospector

        String json = ResourceUtils.find(contextClass, resourceName);
        if (json != null) {
          ObjectMapper mapper = new ObjectMapper();

          // Use JAXB annotations
          AnnotationIntrospector introspector = new JaxbAnnotationIntrospector();
          mapper = mapper.setAnnotationIntrospector(introspector);

          mapper = mapper.configure(JsonParser.Feature.ALLOW_SINGLE_QUOTES, true);
          mapper = mapper.configure(JsonParser.Feature.ALLOW_UNQUOTED_FIELD_NAMES, true);
          mapper = mapper.configure(JsonParser.Feature.ALLOW_COMMENTS, true);
View Full Code Here

Examples of com.fasterxml.jackson.module.jaxb.JaxbAnnotationIntrospector

    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;
View Full Code Here

Examples of com.fasterxml.jackson.module.jaxb.JaxbAnnotationIntrospector

        if (value.containsKey("metadata"))
        {
            byte[] metadata =
                new ObjectMapper().setAnnotationIntrospector(
                    new AnnotationIntrospectorPair(new JacksonAnnotationIntrospector(),
                        new JaxbAnnotationIntrospector(TypeFactory.defaultInstance())))
                    .writeValueAsBytes(value.get("metadata"));
            jgen.writeRawValue(new String(metadata));
        }
        else
        {
View Full Code Here

Examples of com.fasterxml.jackson.module.jaxb.JaxbAnnotationIntrospector

        return result;
    }

    private static AnnotationIntrospector createJaxbJacksonAnnotationIntrospector() {

        final AnnotationIntrospector jaxbIntrospector = new JaxbAnnotationIntrospector(TypeFactory.defaultInstance());
        final AnnotationIntrospector jacksonIntrospector = new JacksonAnnotationIntrospector();

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

Examples of com.fasterxml.jackson.module.jaxb.JaxbAnnotationIntrospector

    // Allow JAX-B annotations.
    setAnnotationIntrospector(
        new AnnotationIntrospector.Pair(
            getSerializationConfig().getAnnotationIntrospector(),
            new JaxbAnnotationIntrospector()));

    // Make Jackson respect @XmlElementWrapper.
    enable(MapperFeature.USE_WRAPPER_NAME_AS_PROPERTY_NAME);

    // Print all dates in ISO8601 format
View Full Code Here

Examples of com.fasterxml.jackson.module.jaxb.JaxbAnnotationIntrospector

        Hibernate4Module hbm = new Hibernate4Module();
        hbm.enable(Hibernate4Module.Feature.FORCE_LAZY_LOADING);
        mapper.registerModule(hbm);

        AnnotationIntrospector primary = new JacksonAnnotationIntrospector();
        AnnotationIntrospector secondary = new JaxbAnnotationIntrospector(
            mapper.getTypeFactory());
        AnnotationIntrospector pair = new AnnotationIntrospectorPair(primary,
            secondary);
        mapper.setAnnotationIntrospector(pair);
    }
View Full Code Here

Examples of com.fasterxml.jackson.module.jaxb.JaxbAnnotationIntrospector

      // Allow JAX-B annotations.
      setAnnotationIntrospector(
            new AnnotationIntrospector.Pair(
                getSerializationConfig().getAnnotationIntrospector(),
                new JaxbAnnotationIntrospector()));

      // Make Jackson respect @XmlElementWrapper.
      enable(MapperFeature.USE_WRAPPER_NAME_AS_PROPERTY_NAME);

      // Print all dates in ISO8601 format
View Full Code Here

Examples of com.fasterxml.jackson.module.jaxb.JaxbAnnotationIntrospector

        // shouldn't fail on.
        this.mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES,
            false);

        AnnotationIntrospector primary = new JacksonAnnotationIntrospector();
        AnnotationIntrospector secondary = new JaxbAnnotationIntrospector(
            mapper.getTypeFactory());
        AnnotationIntrospector pair = new AnnotationIntrospectorPair(primary, secondary);
        this.mapper.setAnnotationIntrospector(pair);
    }
View Full Code Here

Examples of com.fasterxml.jackson.module.jaxb.JaxbAnnotationIntrospector

    @Inject
    public ActivationListener(SubscriptionServiceAdapter subService) {
        this.subscriptionService = subService;
        mapper = new ObjectMapper();
        AnnotationIntrospector primary = new JacksonAnnotationIntrospector();
        AnnotationIntrospector secondary = new JaxbAnnotationIntrospector(
            mapper.getTypeFactory());
        AnnotationIntrospector pair = new AnnotationIntrospectorPair(primary, secondary);
        mapper.setAnnotationIntrospector(pair);
    }
View Full Code Here

Examples of org.codehaus.jackson.xc.JaxbAnnotationIntrospector

    }

    @Override
    protected Object[] getSingletons() {
        ObjectMapper mapper = new ObjectMapper();
        JaxbAnnotationIntrospector jaxbIntrospector = new JaxbAnnotationIntrospector();
        mapper.getSerializationConfig().setAnnotationIntrospector(jaxbIntrospector);
        mapper.getSerializationConfig().set(Feature.WRITE_DATES_AS_TIMESTAMPS, true);
        mapper.getDeserializationConfig().setAnnotationIntrospector(jaxbIntrospector);
        JacksonJsonProvider jacksonProvider = new JacksonJsonProvider(mapper);
        return new Object[] {jacksonProvider};
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.