Class IgnoreJsonIgnore
java.lang.Object
com.fasterxml.jackson.databind.AnnotationIntrospector
com.fasterxml.jackson.databind.introspect.JacksonAnnotationIntrospector
cool.scx.common.jackson.IgnoreJsonIgnore
- All Implemented Interfaces:
com.fasterxml.jackson.core.Versioned,Serializable
public class IgnoreJsonIgnore
extends com.fasterxml.jackson.databind.introspect.JacksonAnnotationIntrospector
忽略 JsonIgnore 注解
这里可能有点难以理解 我们假设一下这种情况 一个实体类的某个字段不想再向前台发送时序列化某个字段 如 password 但是在前台向后台发送 json 时则需要进行序列化 我们可以使用此类 通过 objectMapper.setAnnotationIntrospector(new IgnoreJsonIgnore()); 来设置一个 objectMapper 使其忽略 @JsonIgnore 注解 同时还可以创建另一个 普通的 objectMapper 使其正常识别 @JsonIgnore 注解 换句话说就是使 @JsonIgnore 注解只在 像前台发送数据时使用 项目内部使用时则不会理会 @JsonIgnore 注解
- Version:
- 0.0.1
- Author:
- scx567888
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class com.fasterxml.jackson.databind.AnnotationIntrospector
com.fasterxml.jackson.databind.AnnotationIntrospector.ReferenceProperty, com.fasterxml.jackson.databind.AnnotationIntrospector.XmlExtensions -
Field Summary
FieldsFields inherited from class com.fasterxml.jackson.databind.introspect.JacksonAnnotationIntrospector
_annotationsInside, _cfgConstructorPropertiesImpliesCreator -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanhasIgnoreMarker(com.fasterxml.jackson.databind.introspect.AnnotatedMember m) 此方法默认会调用 _isIgnorable 来查找 是否具有 需要忽略的注解 而 _isIgnorable 则会依次查找是否存在以下两个注解 JsonIgnore(Jackson 提供) Transient(JDK 7 提供) 如果有则使用 注解的 value 否则返回 false 这里因为需要屏蔽掉所有的 JsonIgnore 或 Transient 注解故直接返回 falseMethods inherited from class com.fasterxml.jackson.databind.introspect.JacksonAnnotationIntrospector
_classIfExplicit, _classIfExplicit, _constructNoTypeResolverBuilder, _constructStdTypeResolverBuilder, _constructStdTypeResolverBuilder, _constructVirtualProperty, _constructVirtualProperty, _findConstructorName, _findTypeResolver, _isIgnorable, _propertyName, findAndAddVirtualProperties, findAutoDetectVisibility, findClassDescription, findContentDeserializer, findContentSerializer, findCreatorAnnotation, findCreatorBinding, findDefaultEnumValue, findDefaultEnumValue, findDeserializationContentConverter, findDeserializationConverter, findDeserializer, findEnumAliases, findEnumAliases, findEnumNamingStrategy, findEnumValues, findEnumValues, findFilterId, findFormat, findImplicitPropertyName, findInjectableValue, findInjectableValueId, findKeyDeserializer, findKeySerializer, findMergeInfo, findNameForDeserialization, findNameForSerialization, findNamingStrategy, findNullSerializer, findObjectIdInfo, findObjectReferenceInfo, findPOJOBuilder, findPOJOBuilderConfig, findPolymorphicTypeInfo, findPropertyAccess, findPropertyAliases, findPropertyContentTypeResolver, findPropertyDefaultValue, findPropertyDescription, findPropertyIgnoralByName, findPropertyIgnorals, findPropertyInclusion, findPropertyInclusionByName, findPropertyIndex, findPropertyTypeResolver, findReferenceType, findRenameByField, findRootName, findSerializationContentConverter, findSerializationConverter, findSerializationPropertyOrder, findSerializationSortAlphabetically, findSerializationTyping, findSerializer, findSetterInfo, findSubtypes, findTypeName, findTypeResolver, findUnwrappingNameTransformer, findValueInstantiator, findViews, hasAnyGetter, hasAnyGetterAnnotation, hasAnySetter, hasAnySetterAnnotation, hasAsKey, hasAsValue, hasAsValueAnnotation, hasCreatorAnnotation, hasRequiredMarker, isAnnotationBundle, isIgnorableType, isTypeId, readResolve, refineDeserializationType, refineSerializationType, resolveSetterConflict, setConstructorPropertiesImpliesCreator, versionMethods inherited from class com.fasterxml.jackson.databind.AnnotationIntrospector
_findAnnotation, _hasAnnotation, _hasOneOf, allIntrospectors, allIntrospectors, findDefaultCreator, findEnumValue, findWrapperName, nopInstance, pair
-
Field Details
-
IGNORE_JSON_IGNORE
默认的 NullKey 序列化器
-
-
Constructor Details
-
IgnoreJsonIgnore
public IgnoreJsonIgnore()
-
-
Method Details
-
hasIgnoreMarker
public boolean hasIgnoreMarker(com.fasterxml.jackson.databind.introspect.AnnotatedMember m) 此方法默认会调用 _isIgnorable 来查找 是否具有 需要忽略的注解 而 _isIgnorable 则会依次查找是否存在以下两个注解 JsonIgnore(Jackson 提供) Transient(JDK 7 提供) 如果有则使用 注解的 value 否则返回 false 这里因为需要屏蔽掉所有的 JsonIgnore 或 Transient 注解故直接返回 false- Overrides:
hasIgnoreMarkerin classcom.fasterxml.jackson.databind.introspect.JacksonAnnotationIntrospector- Parameters:
m- m- Returns:
- r
-