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


Java JaxbAnnotationModule类代码示例

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


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

示例1: JacksonMessageSerializer

import com.fasterxml.jackson.module.jaxb.JaxbAnnotationModule; //导入依赖的package包/类
public JacksonMessageSerializer() {
    this(new ObjectMapper());
    objectMapper.registerModule(new JaxbAnnotationModule());
    objectMapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
    objectMapper.configure(
            MapperFeature.ACCEPT_CASE_INSENSITIVE_PROPERTIES, true);
}
 
开发者ID:kenzanlabs,项目名称:bowtie,代码行数:8,代码来源:JacksonMessageSerializer.java

示例2: NsObjectTransducer

import com.fasterxml.jackson.module.jaxb.JaxbAnnotationModule; //导入依赖的package包/类
/**
 * Creates instance of transducer using given NetSuite client.
 *
 * @param clientService client to be used
 */
protected NsObjectTransducer(NetSuiteClientService<?> clientService) {
    this.clientService = clientService;

    try {
        datatypeFactory = DatatypeFactory.newInstance();
    } catch (DatatypeConfigurationException e) {
        throw new ComponentException(e);
    }

    objectMapper = new ObjectMapper();

    // Customize typing of JSON objects.
    objectMapper.setDefaultTyping(new NsTypeResolverBuilder(clientService.getBasicMetaData()));

    // Register JAXB annotation module to perform mapping of data model objects to/from JSON.
    JaxbAnnotationModule jaxbAnnotationModule = new JaxbAnnotationModule();
    objectMapper.registerModule(jaxbAnnotationModule);

    setMetaDataSource(clientService.getMetaDataSource());
}
 
开发者ID:Talend,项目名称:components,代码行数:26,代码来源:NsObjectTransducer.java

示例3: main

import com.fasterxml.jackson.module.jaxb.JaxbAnnotationModule; //导入依赖的package包/类
public static void main(String[] args) throws Exception {

initializeDB();

// Jackson Object Mapper 
ObjectMapper mapper = new ObjectMapper();

// Adding the Jackson Module to process JAXB annotations
      JaxbAnnotationModule module = new JaxbAnnotationModule();
      
// configure as necessary
mapper.registerModule(module);
mapper.configure(SerializationFeature.INDENT_OUTPUT, true);
      mapper.configure(SerializationFeature.ORDER_MAP_ENTRIES_BY_KEYS, true);

      String result = mapper.writeValueAsString(people);
      System.out.println(result);
      mapper.writeValue(new File("people.json"), people);
  }
 
开发者ID:IntroSDE,项目名称:introsde,代码行数:20,代码来源:HealthProfileJson.java

示例4: init

import com.fasterxml.jackson.module.jaxb.JaxbAnnotationModule; //导入依赖的package包/类
@Override
public void init(final ServletConfig config) throws ServletException {
    super.init(config);

    final BeanConfig beanConfig = loadConfig(new File("logs/swagger.properties"));
    beanConfig.setVersion("v1");
    beanConfig.setSchemes(new String[]{"http"});
    beanConfig.setBasePath("/render-ws");
    beanConfig.setResourcePackage("org.janelia.render.service");
    beanConfig.setScan(true);
    beanConfig.setPrettyPrint(true);

    // Needed to register these modules to get Swagger to use JAXB annotations
    // (see https://github.com/swagger-api/swagger-core/issues/960 for explanation)
    Json.mapper().registerModule(new JaxbAnnotationModule());
    Yaml.mapper().registerModule(new JaxbAnnotationModule());
}
 
开发者ID:saalfeldlab,项目名称:render,代码行数:18,代码来源:SwaggerBootstrapServlet.java

示例5: init

import com.fasterxml.jackson.module.jaxb.JaxbAnnotationModule; //导入依赖的package包/类
public void init() {
    SimpleModule module = getModule();

    SimpleDateFormat df = new SimpleDateFormat(DateUtils.DATE_FORMAT);
    df.setTimeZone(TimeZone.getTimeZone("GMT"));

    mapper = new ObjectMapper();
    mapper.setDateFormat(df);
    mapper.registerModule(module);
    mapper.registerModule(new JaxbAnnotationModule());
    mapper.getFactory().configure(JsonGenerator.Feature.AUTO_CLOSE_TARGET, false);
    mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);

    if (escapeForwardSlashes) {
        mapper.getFactory().setCharacterEscapes(new EscapeForwardSlash());
    }
}
 
开发者ID:rancher,项目名称:cattle,代码行数:18,代码来源:JacksonMapper.java

示例6: init

import com.fasterxml.jackson.module.jaxb.JaxbAnnotationModule; //导入依赖的package包/类
@PostConstruct
public void init() {
    SimpleModule module = new SimpleModule();
    module.setMixInAnnotation(Resource.class, ResourceMix.class);
    module.setMixInAnnotation(SchemaCollection.class, SchemaCollectionMixin.class);
    module.setMixInAnnotation(SchemaImpl.class, SchemaImplMixin.class);

    SimpleDateFormat df = new SimpleDateFormat(DateUtils.DATE_FORMAT);
    df.setTimeZone(TimeZone.getTimeZone("GMT"));

    mapper = new ObjectMapper();
    mapper.setDateFormat(df);
    mapper.registerModule(new JaxbAnnotationModule());
    mapper.registerModule(module);
    mapper.getFactory().configure(JsonGenerator.Feature.AUTO_CLOSE_TARGET, false);
    mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);

    if ( escapeForwardSlashes ) {
        mapper.getFactory().setCharacterEscapes(new EscapeForwardSlash());
    }
}
 
开发者ID:rancher,项目名称:gdapi-java-server,代码行数:22,代码来源:JacksonMapper.java

示例7: getSingletons

import com.fasterxml.jackson.module.jaxb.JaxbAnnotationModule; //导入依赖的package包/类
@Override
   /* Risolve il problema del Provider JSON non trovato alla prima richiesta.
    * Vedi https://java.net/jira/browse/GLASSFISH-21141 */
public Set<Object> getSingletons() {
	ObjectMapper mapper = new ObjectMapper();
	mapper.registerModule(new JaxbAnnotationModule());
	return ImmutableSet
 				.<Object> builder()
			.add(new JacksonJaxbJsonProvider(mapper, JacksonJaxbJsonProvider.DEFAULT_ANNOTATIONS)).build();
}
 
开发者ID:aswroma3,项目名称:asw,代码行数:11,代码来源:ProductManagerApplication.java

示例8: objectMapper

import com.fasterxml.jackson.module.jaxb.JaxbAnnotationModule; //导入依赖的package包/类
/**
 * This {@link ObjectMapper} sets up Jackson for some common defaults. This
 * utilizes Vert.x mapper to support their json objects in addition it will
 * prevent <code>null</code> from being put into a resulting JSON.
 *
 * @return configured object mapper
 */
@Bean
public ObjectMapper objectMapper() {

    return Json.mapper.copy()
        .registerModule(new SwaggerModule())
        .registerModule(new JaxbAnnotationModule())
        .setSerializationInclusion(JsonInclude.Include.NON_NULL);
}
 
开发者ID:trajano,项目名称:app-ms,代码行数:16,代码来源:SpringConfiguration.java

示例9: MessageUtils

import com.fasterxml.jackson.module.jaxb.JaxbAnnotationModule; //导入依赖的package包/类
public MessageUtils() {
  xmlMapper = new ExtendedXmlMapper();
  xmlMapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
  xmlMapper.setDateFormat(new ISO8601DateFormat());
  xmlMapper.registerModule(new JaxbAnnotationModule());
  xmlMapper.setSerializationInclusion(Include.NON_NULL);
}
 
开发者ID:daflockinger,项目名称:unitstack,代码行数:8,代码来源:MessageUtils.java

示例10: Client

import com.fasterxml.jackson.module.jaxb.JaxbAnnotationModule; //导入依赖的package包/类
private Client(
    final String host,
    final feign.Client client,
    final feign.Logger.Level logLevel,
    final RequestInterceptor requestInterceptor,
    final Retryer retryer,
    final Request.Options options
) {
    final MetacatJsonLocator metacatJsonLocator = new MetacatJsonLocator();
    final ObjectMapper mapper = metacatJsonLocator
        .getPrettyObjectMapper()
        .copy()
        .registerModule(new GuavaModule())
        .registerModule(new JaxbAnnotationModule());

    log.info("Connecting to {}", host);
    this.host = host;

    feignBuilder = Feign.builder()
        .client(client)
        .logger(new Slf4jLogger())
        .logLevel(logLevel)
        .contract(new JAXRSContract())
        .encoder(new JacksonEncoder(mapper))
        .decoder(new JacksonDecoder(mapper))
        .errorDecoder(new MetacatErrorDecoder(metacatJsonLocator))
        .requestInterceptor(requestInterceptor)
        .retryer(retryer)
        .options(options);

    api = getApiClient(MetacatV1.class);
    partitionApi = getApiClient(PartitionV1.class);
    metadataApi = getApiClient(MetadataV1.class);
    resolverApi = getApiClient(ResolverV1.class);
    tagApi = getApiClient(TagV1.class);
}
 
开发者ID:Netflix,项目名称:metacat,代码行数:37,代码来源:Client.java

示例11: toJSON

import com.fasterxml.jackson.module.jaxb.JaxbAnnotationModule; //导入依赖的package包/类
private <T> String toJSON(T entity) throws IOException {
    StringWriter sw = new StringWriter();

    ObjectMapper mapper = new ObjectMapper();
    mapper.registerModule(new JaxbAnnotationModule());
    mapper.writeValue(sw, entity);

    return sw.toString();
}
 
开发者ID:MyCoRe-Org,项目名称:mycore,代码行数:10,代码来源:MCRJobQueueResource.java

示例12: getContext

import com.fasterxml.jackson.module.jaxb.JaxbAnnotationModule; //导入依赖的package包/类
public ObjectMapper getContext(final Class<?> type) {
    final ObjectMapper retval = new ObjectMapper();
    // if the incoming JSON contains properties not defined in the object model, ignore them
    retval.configure(FAIL_ON_UNKNOWN_PROPERTIES, false);
    // use the JAX-B annotations to map the fields in the Conversation Protocol to the object model
    retval.registerModule(new JaxbAnnotationModule());
    // don't write out properties that are null or empty
    retval.setSerializationInclusion(NON_EMPTY);
    return retval;
}
 
开发者ID:l0s,项目名称:google-actions-conversation-api,代码行数:11,代码来源:JaxRsExample.java

示例13: ClientStarter

import com.fasterxml.jackson.module.jaxb.JaxbAnnotationModule; //导入依赖的package包/类
@VisibleForTesting
ClientStarter(@NonNull JerseyClientBuilder jerseyClientBuilder, @NonNull ObjectMapper objectMapper) {
	this.jerseyClientBuilder = jerseyClientBuilder;
	this.objectMapper = objectMapper;

	JaxbAnnotationModule module = new JaxbAnnotationModule();
	objectMapper.registerModule(module);
	this.clientConfig = createConfig();
}
 
开发者ID:Mercateo,项目名称:rest-hateoas-client,代码行数:10,代码来源:ClientStarter.java

示例14: accept

import com.fasterxml.jackson.module.jaxb.JaxbAnnotationModule; //导入依赖的package包/类
public void accept(ObjectMapper mapper) {
	
	
	JaxbAnnotationModule module = new JaxbAnnotationModule();
	// configure as necessary
	inc.map(include->mapper.setSerializationInclusion(include));
	mapper.registerModule(module);
	PluginLoader.INSTANCE.plugins.get().stream()
		.filter(m -> m.jacksonModules()!=null)
		.flatMap(m -> m.jacksonModules().stream())
		.forEach(m -> mapper.registerModule(m));
		
	mapper.registerModule(new Jdk8Module());
}
 
开发者ID:aol,项目名称:micro-server,代码行数:15,代码来源:CoreJacksonConfigurator.java

示例15: afterPropertiesSet

import com.fasterxml.jackson.module.jaxb.JaxbAnnotationModule; //导入依赖的package包/类
@Override
public void afterPropertiesSet() throws Exception {
    mapper = new ObjectMapper();
    mapper.configure(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY, true);
    // serializing to singleelement arrays is enabled by default but just in case they change this in the future...
    mapper.configure(SerializationFeature.WRITE_SINGLE_ELEM_ARRAYS_UNWRAPPED, false);
    
    // Register the JAXB annotation module 
    JaxbAnnotationModule jaxbModule = new JaxbAnnotationModule();
    // Make sure that JAXB is the primary serializer (technically the default behavior but let's be explicit)
    jaxbModule.setPriority(Priority.PRIMARY);
    mapper.registerModule(new JaxbAnnotationModule());
    
    mapper.setTypeFactory(TypeFactory.defaultInstance().withModifier(typeModifier));
}
 
开发者ID:takbani,项目名称:blcdemo,代码行数:16,代码来源:JaxrsObjectMapperProvider.java


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