本文整理匯總了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);
}