-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Closed
Milestone
Description
The ptv is not used, but the javadoc says it is to be used, is it a bug?
/**
* Method for enabling automatic inclusion of type information ("Default Typing")
* -- needed for proper deserialization of polymorphic types (unless types
* have been annotated with {@link com.fasterxml.jackson.annotation.JsonTypeInfo}) --
* using "As.PROPERTY" inclusion mechanism and specified property name
* to use for inclusion (default being "@class" since default type information
* always uses class name as type identifier)
*<p>
* NOTE: choice of {@link PolymorphicTypeValidator} to pass is critical for security
* as allowing all subtypes can be risky for untrusted content.
*
* @param ptv Validator used to verify that actual subtypes to deserialize are valid against
* whatever criteria validator uses: important in case where untrusted content is deserialized.
* @param applicability Defines kinds of types for which additional type information
* is added; see {@link DefaultTyping} for more information.
* @param propertyName Name of property used for including type id for polymorphic values.
*
* @since 2.10
*/
public ObjectMapper activateDefaultTypingAsProperty(PolymorphicTypeValidator ptv,
DefaultTyping applicability, String propertyName)
{
TypeResolverBuilder<?> typer = _constructDefaultTypeResolverBuilder(applicability,
getPolymorphicTypeValidator());
// we'll always use full class name, when using defaulting
typer = typer.init(JsonTypeInfo.Id.CLASS, null);
typer = typer.inclusion(JsonTypeInfo.As.PROPERTY);
typer = typer.typeProperty(propertyName);
return setDefaultTyping(typer);
}
dirkbolte
Metadata
Metadata
Assignees
Labels
No labels