Package com.fasterxml.jackson.databind

Examples of com.fasterxml.jackson.databind.AnnotationIntrospector$Pair


        }
    }

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


  /**
   * Annotation introspector to use for serialization process
   * is configured separately for serialization and deserialization purposes
   */
  public JaxbJacksonObjectMapper() {
      final AnnotationIntrospector introspector
          = new JacksonAnnotationIntrospector();
      super.getDeserializationConfig()
           .with(introspector);
      super.getSerializationConfig()
           .with(introspector);
View Full Code Here

        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

    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

            getLogger().info(
                    "using default introspector:"
                            + primary.getClass().getName());
            mapper.setAnnotationIntrospector(primary);
        } else if (primary != null && secondary != null){
            AnnotationIntrospector pair = new AnnotationIntrospectorPair(
                    primary, secondary);
            mapper.setAnnotationIntrospector(pair);
        } else {
            mapper.setAnnotationIntrospector(primary);
        }
View Full Code Here

        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

        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

        // properties that this current server doesn't know how to serialize, but still
        // 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

    @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

        SimpleFilterProvider filterProvider = new SimpleFilterProvider();
        filterProvider.setDefaultFilter(new DynamicPropertyFilter());
        filterProvider.setFailOnUnknownId(false);
        mapper.setFilters(filterProvider);

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

TOP

Related Classes of com.fasterxml.jackson.databind.AnnotationIntrospector$Pair

Copyright © 2018 www.massapicom. 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.