本文整理汇总了Java中com.fasterxml.jackson.databind.ObjectMapper.setAnnotationIntrospector方法的典型用法代码示例。如果您正苦于以下问题:Java ObjectMapper.setAnnotationIntrospector方法的具体用法?Java ObjectMapper.setAnnotationIntrospector怎么用?Java ObjectMapper.setAnnotationIntrospector使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.fasterxml.jackson.databind.ObjectMapper
的用法示例。
在下文中一共展示了ObjectMapper.setAnnotationIntrospector方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: outfitMetadataFilter
import com.fasterxml.jackson.databind.ObjectMapper; //导入方法依赖的package包/类
/**
* Outfit the given {@link ObjectMapper} with a filter that will treat all metadata map entries as transient.
*
* @param om object mapper to modify
*/
private static void outfitMetadataFilter(ObjectMapper om) {
final String filterName = "exclude-metadata";
SimpleFilterProvider filters = new SimpleFilterProvider();
filters.addFilter(filterName, new MetadataPropertyFilter());
om.setAnnotationIntrospector(new JsonWrapperIntrospector(filterName));
om.setFilterProvider(filters);
}
示例2: configureObjectMapper
import com.fasterxml.jackson.databind.ObjectMapper; //导入方法依赖的package包/类
/**
* Call this method with an {@link ObjectMapper} to configure the object
* mapper to use this {@link SimpleClassNameIdResolver}.
*
* @param mapper the object mapper to configure.
*/
public static void configureObjectMapper(final ObjectMapper mapper) {
mapper.setAnnotationIntrospector(new DelegatingAnnotationIntrospector.Builder()
.add(new SimpleClassNameIdResolverAnnotation())
.build());
mapper.registerModule(SimpleClassSerializer.getModule());
}
示例3: JacksonSerializer
import com.fasterxml.jackson.databind.ObjectMapper; //导入方法依赖的package包/类
public JacksonSerializer() {
m_objectMapper = new ObjectMapper();
m_objectMapper.setAnnotationIntrospector(new JaxbAnnotationIntrospector(TypeFactory.defaultInstance()));
m_objectMapper.configure(MapperFeature.SORT_PROPERTIES_ALPHABETICALLY, true);
m_objectMapper.configure(SerializationFeature.ORDER_MAP_ENTRIES_BY_KEYS, true);
}
示例4: setAnnotationIntrospectors
import com.fasterxml.jackson.databind.ObjectMapper; //导入方法依赖的package包/类
private void setAnnotationIntrospectors(ObjectMapper mapper) {
AnnotationIntrospector curSerIntro = mapper.getSerializationConfig().getAnnotationIntrospector();
AnnotationIntrospector newSerIntro = AnnotationIntrospectorPair.pair(curSerIntro,
new MaskableSensitiveDataAnnotationIntrospector());
mapper.setAnnotationIntrospector(newSerIntro);
}