当前位置: 首页>>代码示例>>Java>>正文


Java AnnotationIntrospectorPair类代码示例

本文整理汇总了Java中com.fasterxml.jackson.databind.introspect.AnnotationIntrospectorPair的典型用法代码示例。如果您正苦于以下问题:Java AnnotationIntrospectorPair类的具体用法?Java AnnotationIntrospectorPair怎么用?Java AnnotationIntrospectorPair使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


AnnotationIntrospectorPair类属于com.fasterxml.jackson.databind.introspect包,在下文中一共展示了AnnotationIntrospectorPair类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createObjectMapper

import com.fasterxml.jackson.databind.introspect.AnnotationIntrospectorPair; //导入依赖的package包/类
/**
 * Create an <code>ObjectMapper</code> for Pipeline configuration.
 *
 * @param injector The Guice <code>Injector</code> instance.
 * @return An <code>ObjectMapper</code> for Pipeline configuration.
 */
public static ObjectMapper createObjectMapper(final Injector injector) {
    final ObjectMapper objectMapper = ObjectMapperFactory.createInstance();

    final SimpleModule module = new SimpleModule("Pipeline");
    module.addDeserializer(Statistic.class, new StatisticDeserializer());

    objectMapper.registerModules(module);

    final GuiceAnnotationIntrospector guiceIntrospector = new GuiceAnnotationIntrospector();
    objectMapper.setInjectableValues(new GuiceInjectableValues(injector));
    objectMapper.setAnnotationIntrospectors(
            new AnnotationIntrospectorPair(
                    guiceIntrospector, objectMapper.getSerializationConfig().getAnnotationIntrospector()),
            new AnnotationIntrospectorPair(
                    guiceIntrospector, objectMapper.getDeserializationConfig().getAnnotationIntrospector()));

    return objectMapper;
}
 
开发者ID:ArpNetworking,项目名称:metrics-aggregator-daemon,代码行数:25,代码来源:PipelineConfiguration.java

示例2: createJsonFactory

import com.fasterxml.jackson.databind.introspect.AnnotationIntrospectorPair; //导入依赖的package包/类
private JsonFactory createJsonFactory() {
    final ObjectMapper objectMapper = new ObjectMapper();

    objectMapper.setAnnotationIntrospector(
            new AnnotationIntrospectorPair(
                    new JacksonAnnotationIntrospector(),
                    new JaxbAnnotationIntrospector(TypeFactory.defaultInstance())));

    objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
    objectMapper.configure(SerializationFeature.WRITE_EMPTY_JSON_ARRAYS, true);

    final DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
    df.setTimeZone(TimeZone.getTimeZone("GMT"));
    objectMapper.setDateFormat(df);

    return objectMapper.getFactory();
}
 
开发者ID:RIPE-NCC,项目名称:whois,代码行数:18,代码来源:RdapResponseJsonTest.java

示例3: reportXml

import com.fasterxml.jackson.databind.introspect.AnnotationIntrospectorPair; //导入依赖的package包/类
public static void reportXml(Writer out, Report report) throws IOException {
	XmlMapper mapper = new XmlMapper();
	mapper.addMixIn(Report.class, ReportMixIn.class);
	AnnotationIntrospector first = new SimpleTypesAsAttributesAnnotationIntrospector();
	AnnotationIntrospector second = new JacksonXmlAnnotationIntrospector(false);
	mapper.setAnnotationIntrospector(new AnnotationIntrospectorPair(first, second));
	
	out.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
	mapper.writeValue(out, report);
}
 
开发者ID:pescuma,项目名称:buildhealth,代码行数:11,代码来源:BuildHealthWebServer.java

示例4: init

import com.fasterxml.jackson.databind.introspect.AnnotationIntrospectorPair; //导入依赖的package包/类
@PostConstruct
public void init() {
    objectMapper = new ObjectMapper()
            .setAnnotationIntrospector(
                    new AnnotationIntrospectorPair(
                            new JaxbAnnotationIntrospector(TypeFactory.defaultInstance())
                            , new JacksonAnnotationIntrospector()
                    )
            )
            .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
}
 
开发者ID:EsikAntony,项目名称:camunda-task-dispatcher,代码行数:12,代码来源:JsonTaskMapper.java

示例5: RowSerializer

import com.fasterxml.jackson.databind.introspect.AnnotationIntrospectorPair; //导入依赖的package包/类
public RowSerializer(){
	mapper = new ObjectMapper();
	mapper.setAnnotationIntrospector(new AnnotationIntrospectorPair(
			new JacksonAnnotationIntrospector(),
			new JaxbAnnotationIntrospector(mapper.getTypeFactory())
	));
}
 
开发者ID:eyce9000,项目名称:iem4j,代码行数:8,代码来源:RowSerializer.java

示例6: getJAXBandJacksonSerializer

import com.fasterxml.jackson.databind.introspect.AnnotationIntrospectorPair; //导入依赖的package包/类
public static RowSerializer getJAXBandJacksonSerializer(){
	RowSerializer serializer = new RowSerializer();
	serializer.mapper.setAnnotationIntrospector(new AnnotationIntrospectorPair(
			new JacksonAnnotationIntrospector(),
			new JaxbAnnotationIntrospector(serializer.mapper.getTypeFactory())
	));
	return serializer;
}
 
开发者ID:eyce9000,项目名称:iem4j,代码行数:9,代码来源:RowSerializer.java

示例7: JacksonProvider

import com.fasterxml.jackson.databind.introspect.AnnotationIntrospectorPair; //导入依赖的package包/类
public JacksonProvider() {
	AnnotationIntrospector introspector = new JaxbAnnotationIntrospector(TypeFactory.defaultInstance());
	// if using BOTH JAXB annotations AND Jackson annotations:
	AnnotationIntrospector secondary = new JacksonAnnotationIntrospector();

	ObjectMapper mapper = new ObjectMapper().registerModule(new Hibernate4Module())
			.setSerializationInclusion(Include.NON_NULL)
			.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false).enable(SerializationFeature.INDENT_OUTPUT)
			.setAnnotationIntrospector(new AnnotationIntrospectorPair(introspector, secondary));
	// mapper = mapper.setSerializationInclusion(Include)
	setMapper(mapper);
}
 
开发者ID:infinitiessoft,项目名称:keystone4j,代码行数:13,代码来源:JacksonProvider.java

示例8: ObjectMapperResolver

import com.fasterxml.jackson.databind.introspect.AnnotationIntrospectorPair; //导入依赖的package包/类
public ObjectMapperResolver() {
	objectMapper = new ObjectMapper();
	AnnotationIntrospector introspector = new JaxbAnnotationIntrospector(TypeFactory.defaultInstance());
	AnnotationIntrospector secondary = new JacksonAnnotationIntrospector();
	objectMapper = objectMapper.setAnnotationIntrospector(new AnnotationIntrospectorPair(introspector, secondary));
	objectMapper = objectMapper.enable(SerializationFeature.INDENT_OUTPUT);
	objectMapper.registerModule(new Hibernate4Module());
}
 
开发者ID:infinitiessoft,项目名称:keystone4j,代码行数:9,代码来源:ObjectMapperResolver.java

示例9: createJaxbMapper

import com.fasterxml.jackson.databind.introspect.AnnotationIntrospectorPair; //导入依赖的package包/类
/**
 * Creates a configured mapper supporting JAXB.
 * @see #createObjectMapper(com.fasterxml.jackson.databind.ObjectMapper)
 */
public static ObjectMapper createJaxbMapper() {
    ObjectMapper om = createObjectMapper(createObjectMapper());
    JaxbAnnotationIntrospector jaxbIntr = new JaxbAnnotationIntrospector(om.getTypeFactory());
    JacksonAnnotationIntrospector jsonIntr = new JacksonAnnotationIntrospector();
    om.setAnnotationIntrospector(new AnnotationIntrospectorPair(jsonIntr, jaxbIntr));
    return om;
}
 
开发者ID:proarc,项目名称:proarc,代码行数:12,代码来源:JsonUtils.java

示例10: build

import com.fasterxml.jackson.databind.introspect.AnnotationIntrospectorPair; //导入依赖的package包/类
public JacksonSerializer build() {
  final ObjectMapper objectMapper = mapperFromJSONFactory(jsonFactory);

  if (usePropertyForTypeInformation) {
    objectMapper.enableDefaultTypingAsProperty(ObjectMapper.DefaultTyping.NON_FINAL, "@class");
    objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
  } else {
    objectMapper.enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL);
  }

  if (usePrettyOutput) {
    objectMapper.enable(SerializationFeature.INDENT_OUTPUT);
  }

  if (injectableValues != null) {
    // this is from jackson-module-guice's ObjectMapperModule.get()
    // we do this in a separate method because we do not currently want to inject the ObjectMapper
    objectMapper.setInjectableValues(injectableValues);
    objectMapper.setAnnotationIntrospectors(
        new AnnotationIntrospectorPair(
            annotationIntrospector,
            objectMapper.getSerializationConfig().getAnnotationIntrospector()
        ),
        new AnnotationIntrospectorPair(
            annotationIntrospector,
            objectMapper.getDeserializationConfig().getAnnotationIntrospector()
        )
    );
  }

  return new JacksonSerializer(objectMapper);
}
 
开发者ID:BBN-E,项目名称:bue-common-open,代码行数:33,代码来源:JacksonSerializer.java

示例11: StreamClient

import com.fasterxml.jackson.databind.introspect.AnnotationIntrospectorPair; //导入依赖的package包/类
private StreamClient(final String endpoint, final String username, final String password,
    final SSLConfiguration sslConfiguration, final Consumer<Event> consumer,
    final Runnable beforeReconnection, final Runnable afterReconnection,
    final boolean reconnect, final int reconnectAttempts,
    final int pauseBeforeReconnectInSeconds)
{
    this.endpoint = checkNotNull(endpoint, "endpoint cannot be null");
    this.username = checkNotNull(username, "username cannot be null");
    this.password = checkNotNull(password, "password cannot be null");
    this.consumer = checkNotNull(consumer, "consumer cannot be null");
    this.sslConfiguration = sslConfiguration;
    this.reconnect = checkNotNull(reconnect);
    if (this.reconnect)
    {
        this.reconnectAttempts = checkNotNull(reconnectAttempts,
            "reconnect attempts cannot be null if reconnection has been enabled");
        this.pauseBeforeReconnectInSeconds = checkNotNull(pauseBeforeReconnectInSeconds,
            "pause seconds before reconnect cannot be null if reconnection has been enabled");
        this.beforeReconnection = beforeReconnection;
        this.afterReconnection = afterReconnection;
    }
    else
    {
        this.beforeReconnection = null;
        this.afterReconnection = null;
    }

    json = new ObjectMapper()
        .setAnnotationIntrospector( //
            new AnnotationIntrospectorPair(new JacksonAnnotationIntrospector(),
                new JaxbAnnotationIntrospector(TypeFactory.defaultInstance()))) //
        .registerModule(new AbiquoModule());
}
 
开发者ID:abiquo,项目名称:api-java-client,代码行数:34,代码来源:StreamClient.java

示例12: JacksonJsonMapper

import com.fasterxml.jackson.databind.introspect.AnnotationIntrospectorPair; //导入依赖的package包/类
public JacksonJsonMapper() {
        mapper = new ObjectMapper();
//        mapper.setSerializationInclusion(Include.NON_NULL);
        mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);

        AnnotationIntrospector primary = new JacksonAnnotationIntrospector();
        AnnotationIntrospector secondary = new JaxbAnnotationIntrospector(mapper.getTypeFactory());

        AnnotationIntrospector pair = AnnotationIntrospectorPair.create(primary, secondary);
        mapper.setAnnotationIntrospector(pair);
    }
 
开发者ID:cloudnautique,项目名称:cloud-cattle,代码行数:12,代码来源:JacksonJsonMapper.java

示例13: AtmospherePermissionCheckResource

import com.fasterxml.jackson.databind.introspect.AnnotationIntrospectorPair; //导入依赖的package包/类
public AtmospherePermissionCheckResource() {
    om = new ObjectMapper();
    // JAXB annotation
    AnnotationIntrospector jaxbIntrospector = new JaxbAnnotationIntrospector(TypeFactory.defaultInstance());
    AnnotationIntrospector jacksonIntrospector = new JacksonAnnotationIntrospector();
    om.setAnnotationIntrospector(new AnnotationIntrospectorPair(jaxbIntrospector, jacksonIntrospector));
}
 
开发者ID:freedomotic,项目名称:freedomotic,代码行数:8,代码来源:AtmospherePermissionCheckResource.java

示例14: AbstractWSResource

import com.fasterxml.jackson.databind.introspect.AnnotationIntrospectorPair; //导入依赖的package包/类
public AbstractWSResource() {
    //api = Freedomotic.INJECTOR.getInstance(API.class);
    om = new ObjectMapper();
    // JAXB annotation
    AnnotationIntrospector jaxbIntrospector = new JaxbAnnotationIntrospector(TypeFactory.defaultInstance());
    AnnotationIntrospector jacksonIntrospector = new JacksonAnnotationIntrospector();
    om.setAnnotationIntrospector(new AnnotationIntrospectorPair(jaxbIntrospector, jacksonIntrospector));

}
 
开发者ID:freedomotic,项目名称:freedomotic,代码行数:10,代码来源:AbstractWSResource.java

示例15: setAnnotationIntrospectors

import com.fasterxml.jackson.databind.introspect.AnnotationIntrospectorPair; //导入依赖的package包/类
private void setAnnotationIntrospectors(ObjectMapper mapper) {
    AnnotationIntrospector curSerIntro = mapper.getSerializationConfig().getAnnotationIntrospector();
    AnnotationIntrospector newSerIntro = AnnotationIntrospectorPair.pair(curSerIntro,
            new MaskableSensitiveDataAnnotationIntrospector());
    mapper.setAnnotationIntrospector(newSerIntro);
}
 
开发者ID:visionarts,项目名称:power-jambda,代码行数:7,代码来源:MaskableObjectMapper.java


注:本文中的com.fasterxml.jackson.databind.introspect.AnnotationIntrospectorPair类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。