Class LaissezFaireSubTypeValidator
java.lang.Object
edu.internet2.middleware.grouperClientExt.com.fasterxml.jackson.databind.jsontype.PolymorphicTypeValidator
edu.internet2.middleware.grouperClientExt.com.fasterxml.jackson.databind.jsontype.PolymorphicTypeValidator.Base
edu.internet2.middleware.grouperClientExt.com.fasterxml.jackson.databind.jsontype.impl.LaissezFaireSubTypeValidator
- All Implemented Interfaces:
Serializable
Default
PolymorphicTypeValidator
used unless explicit one is constructed
(and, in 2.11, MapperFeature.BLOCK_UNSAFE_POLYMORPHIC_BASE_TYPES
not enabled).
Does not do any validation, allows all subtypes. Only used for backwards-compatibility
reasons: users should usually NOT use such a permissive implementation but use
allow-list/criteria - based implementation.- Since:
- 2.10
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class edu.internet2.middleware.grouperClientExt.com.fasterxml.jackson.databind.jsontype.PolymorphicTypeValidator
PolymorphicTypeValidator.Base, PolymorphicTypeValidator.Validity
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvalidateBaseType
(MapperConfig<?> ctxt, JavaType baseType) Method called when a property with polymorphic value is encountered, and aTypeResolverBuilder
is needed.validateSubClassName
(MapperConfig<?> ctxt, JavaType baseType, String subClassName) validateSubType
(MapperConfig<?> ctxt, JavaType baseType, JavaType subType) Method called after class name has been resolved to actual type, in cases where previous call toPolymorphicTypeValidator.validateSubClassName(edu.internet2.middleware.grouperClientExt.com.fasterxml.jackson.databind.cfg.MapperConfig<?>, edu.internet2.middleware.grouperClientExt.com.fasterxml.jackson.databind.JavaType, java.lang.String)
returnedPolymorphicTypeValidator.Validity.INDETERMINATE
.
-
Field Details
-
instance
-
-
Constructor Details
-
LaissezFaireSubTypeValidator
public LaissezFaireSubTypeValidator()
-
-
Method Details
-
validateBaseType
Description copied from class:PolymorphicTypeValidator
Method called when a property with polymorphic value is encountered, and aTypeResolverBuilder
is needed. Intent is to allow early determination of cases where subtyping is completely denied (for example for security reasons), or, conversely, allowed for allow subtypes (when base type guarantees that all subtypes are known to be safe). Check can be thought of as both optimization (for latter case) and eager-fail (for former case) to give better feedback.- Overrides:
validateBaseType
in classPolymorphicTypeValidator.Base
- Parameters:
ctxt
- Configuration for resolution: typically will beDeserializationConfig
baseType
- Nominal base type used for polymorphic handling: subtypes MUST be instances of this type and assignment compatibility is verified by Jackson core- Returns:
- Determination of general validity of all subtypes of given base type; if
PolymorphicTypeValidator.Validity.ALLOWED
returned, all subtypes will automatically be accepted without further checks; isPolymorphicTypeValidator.Validity.DENIED
returned no subtyping allowed at all (caller will usually throw an exception); otherwise (returnPolymorphicTypeValidator.Validity.INDETERMINATE
) per sub-type validation calls are made for each new subclass encountered.
-
validateSubClassName
public PolymorphicTypeValidator.Validity validateSubClassName(MapperConfig<?> ctxt, JavaType baseType, String subClassName) Description copied from class:PolymorphicTypeValidator
Method called after intended class name for subtype has been read (and in case of minimal class name, expanded to fully-qualified class name) but before attempt is made to look up actualClass
orJavaType
. Validator may be able to determine validity of eventual type (and returnPolymorphicTypeValidator.Validity.ALLOWED
orPolymorphicTypeValidator.Validity.DENIED
) or, if not able to, can defer validation to actual resolved type by returningPolymorphicTypeValidator.Validity.INDETERMINATE
.Validator may also choose to indicate denial by throwing a
JsonMappingException
(such asInvalidTypeIdException
)- Overrides:
validateSubClassName
in classPolymorphicTypeValidator.Base
- Parameters:
ctxt
- Configuration for resolution: typically will beDeserializationConfig
baseType
- Nominal base type used for polymorphic handling: subtypes MUST be instances of this type and assignment compatibility is verified by Jackson coresubClassName
- Name of class that will be resolved toClass
if (and only if) validity check is not denied.- Returns:
- Determination of validity of given class name, as a subtype of given base type:
should NOT return
null
-
validateSubType
public PolymorphicTypeValidator.Validity validateSubType(MapperConfig<?> ctxt, JavaType baseType, JavaType subType) Description copied from class:PolymorphicTypeValidator
Method called after class name has been resolved to actual type, in cases where previous call toPolymorphicTypeValidator.validateSubClassName(edu.internet2.middleware.grouperClientExt.com.fasterxml.jackson.databind.cfg.MapperConfig<?>, edu.internet2.middleware.grouperClientExt.com.fasterxml.jackson.databind.JavaType, java.lang.String)
returnedPolymorphicTypeValidator.Validity.INDETERMINATE
. Validator should be able to determine validity and return appropriatePolymorphicTypeValidator.Validity
value, although it may alsoValidator may also choose to indicate denial by throwing a
JsonMappingException
(such asInvalidTypeIdException
)- Overrides:
validateSubType
in classPolymorphicTypeValidator.Base
- Parameters:
ctxt
- Configuration for resolution: typically will beDeserializationConfig
baseType
- Nominal base type used for polymorphic handling: subtypes MUST be instances of this type and assignment compatibility has been verified by Jackson coresubType
- Resolved subtype to validate- Returns:
- Determination of validity of given class name, as a subtype of given base type:
should NOT return
null
-