Top Description Fields Constructors Methods
tools.jackson.dataformat.avro

pack-priv final Class AvroSubTypeValidator

extends Base
Class Inheritance
Imports
tools.jackson.databind.DatabindContext, .JavaType, tools.jackson.databind.jsontype.PolymorphicTypeValidator

Simple PolymorphicTypeValidator implementation used by with Avro's polymorphic type handling. Does actually allow all subtypes because set of allowed types is dictated by Avro Schema and not by arbitrary class names.

Note that use of validator in any other context, like with formats that allow arbitrary class names, would be unsafe.

Field Summary

Modifier and TypeField and Description
public static final AvroSubTypeValidator
private static final long

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public PolymorphicTypeValidator.Validity
validateBaseType(DatabindContext ctxt, JavaType baseType)

Overrides tools.jackson.databind.jsontype.PolymorphicTypeValidator.Base.validateBaseType.

Method called when a property with polymorphic value is encountered, and a TypeResolverBuilder is needed.

public PolymorphicTypeValidator.Validity
validateSubClassName(DatabindContext ctxt, JavaType baseType, String subClassName)

Overrides tools.jackson.databind.jsontype.PolymorphicTypeValidator.Base.validateSubClassName.

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 actual java.lang.Class or JavaType.

public PolymorphicTypeValidator.Validity
validateSubType(DatabindContext ctxt, JavaType baseType, JavaType subType)

Overrides tools.jackson.databind.jsontype.PolymorphicTypeValidator.Base.validateSubType.

Method called after class name has been resolved to actual type, in cases where previous call to validateSubClassName returned Validity#INDETERMINATE.

Field Detail

instanceback to summary
public static final AvroSubTypeValidator instance
serialVersionUIDback to summary
private static final long serialVersionUID

Hides tools.jackson.databind.jsontype.PolymorphicTypeValidator.Base.serialVersionUID.

Constructor Detail

AvroSubTypeValidatorback to summary
pack-priv AvroSubTypeValidator()

Method Detail

validateBaseTypeback to summary
public PolymorphicTypeValidator.Validity validateBaseType(DatabindContext ctxt, JavaType baseType)

Overrides tools.jackson.databind.jsontype.PolymorphicTypeValidator.Base.validateBaseType.

Doc from tools.jackson.databind.jsontype.PolymorphicTypeValidator.validateBaseType.

Method called when a property with polymorphic value is encountered, and a TypeResolverBuilder 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.

Annotations
@Override
validateSubClassNameback to summary
public PolymorphicTypeValidator.Validity validateSubClassName(DatabindContext ctxt, JavaType baseType, String subClassName)

Overrides tools.jackson.databind.jsontype.PolymorphicTypeValidator.Base.validateSubClassName.

Doc from tools.jackson.databind.jsontype.PolymorphicTypeValidator.validateSubClassName.

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 actual java.lang.Class or JavaType. Validator may be able to determine validity of eventual type (and return Validity#ALLOWED or Validity#DENIED) or, if not able to, can defer validation to actual resolved type by returning Validity#INDETERMINATE.

Validator may also choose to indicate denial by throwing a DatabindException (such as tools.jackson.databind.exc.InvalidTypeIdException)

Annotations
@Override
validateSubTypeback to summary
public PolymorphicTypeValidator.Validity validateSubType(DatabindContext ctxt, JavaType baseType, JavaType subType)

Overrides tools.jackson.databind.jsontype.PolymorphicTypeValidator.Base.validateSubType.

Doc from tools.jackson.databind.jsontype.PolymorphicTypeValidator.validateSubType.

Method called after class name has been resolved to actual type, in cases where previous call to validateSubClassName returned Validity#INDETERMINATE. Validator should be able to determine validity and return appropriate Validity value, although it may also

Validator may also choose to indicate denial by throwing a DatabindException (such as tools.jackson.databind.exc.InvalidTypeIdException)

Annotations
@Override