Module tools.jackson.databind
Class UnwrappedPropertyHandler
java.lang.Object
tools.jackson.databind.deser.impl.UnwrappedPropertyHandler
Object that is responsible for handling acrobatics related to
deserializing "unwrapped" values; sets of properties that are
embedded (inlined) as properties of parent JSON object.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final booleanFlag that indicates that we cannot tell from property names alone whether an incoming property is "unwrapped": either some unwrapped deserializer has an "any setter" (seeJsonAnySetter), or is "opaque" -- declares no property names (viaValueDeserializer.collectAllPropertyNamesTo(java.util.Set<java.lang.String>)), as is the case for custom unwrapping deserializers that capture arbitrary fields.protected final List<SettableBeanProperty>protected final List<SettableBeanProperty>Set of all unwrapped property names from unwrapped deserializers.static final String -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedUnwrappedPropertyHandler(List<SettableBeanProperty> creatorProps, List<SettableBeanProperty> props, Set<String> unwrappedPropertyNames, boolean acceptsAllUnwrapped) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddCreatorProperty(SettableBeanProperty property) voidaddProperty(SettableBeanProperty property) voidcollectUnwrappedPropertyNamesTo(Set<String> names) Method for collecting property names recognized by unwrapped deserializers.static PropertyNamecreatorParamName(int index) Generates a placeholder name for creator properties that don't have a name, but are marked with `@JsonUnwrapped` annotation.booleanhasUnwrappedProperty(String propName) Method that checks if the given property name belongs to any unwrapped property.Creates a new UnwrappedPropertyHandler with initialized unwrapped property names cache.processUnwrapped(JsonParser originalParser, DeserializationContext ctxt, Object bean, TokenBuffer buffered) Deprecated.processUnwrapped(JsonParser originalParser, DeserializationContext ctxt, Object bean, TokenBuffer buffered, boolean hasUnwrappedContent) Processes unwrapped properties from the buffered token stream.processUnwrappedCreatorProperties(JsonParser originalParser, DeserializationContext ctxt, PropertyValueBuffer values, TokenBuffer buffered) renameAll(DeserializationContext ctxt, NameTransformer transformer)
-
Field Details
-
JSON_UNWRAPPED_NAME_PREFIX
- Since:
- 2.19
- See Also:
-
_creatorProperties
- Since:
- 2.19
-
_properties
-
_unwrappedPropertyNames
Set of all unwrapped property names from unwrapped deserializers.- Since:
- 3.1
-
_acceptsAllUnwrapped
protected final boolean _acceptsAllUnwrappedFlag that indicates that we cannot tell from property names alone whether an incoming property is "unwrapped": either some unwrapped deserializer has an "any setter" (seeJsonAnySetter), or is "opaque" -- declares no property names (viaValueDeserializer.collectAllPropertyNamesTo(java.util.Set<java.lang.String>)), as is the case for custom unwrapping deserializers that capture arbitrary fields. When set, all otherwise-unrecognized properties are routed to the unwrapped deserializers -- as was the case before [databind#650].- Since:
- 3.1
-
-
Constructor Details
-
UnwrappedPropertyHandler
public UnwrappedPropertyHandler() -
UnwrappedPropertyHandler
protected UnwrappedPropertyHandler(List<SettableBeanProperty> creatorProps, List<SettableBeanProperty> props, Set<String> unwrappedPropertyNames, boolean acceptsAllUnwrapped)
-
-
Method Details
-
initializeUnwrappedPropertyNames
Creates a new UnwrappedPropertyHandler with initialized unwrapped property names cache.- Since:
- 3.1
-
addCreatorProperty
- Since:
- 2.19
-
addProperty
-
renameAll
-
processUnwrappedCreatorProperties
public PropertyValueBuffer processUnwrappedCreatorProperties(JsonParser originalParser, DeserializationContext ctxt, PropertyValueBuffer values, TokenBuffer buffered) - Since:
- 2.19
-
processUnwrapped
public Object processUnwrapped(JsonParser originalParser, DeserializationContext ctxt, Object bean, TokenBuffer buffered, boolean hasUnwrappedContent) Processes unwrapped properties from the buffered token stream.- Parameters:
originalParser- Parser from which input was originally readctxt- Deserialization contextbean- the target value objectbuffered- the token buffer containing the JSON tokens to deserialize- Returns:
- the bean with unwrapped properties set
- Since:
- 3.1
-
processUnwrapped
@Deprecated public Object processUnwrapped(JsonParser originalParser, DeserializationContext ctxt, Object bean, TokenBuffer buffered) Deprecated. -
creatorParamName
Generates a placeholder name for creator properties that don't have a name, but are marked with `@JsonUnwrapped` annotation.- Since:
- 2.19
-
hasUnwrappedProperty
Method that checks if the given property name belongs to any unwrapped property.- Parameters:
propName- Property name to check- Returns:
trueif name is recognized by an unwrapped deserializer (or if any of them has "any setter")- Since:
- 3.1
-
collectUnwrappedPropertyNamesTo
Method for collecting property names recognized by unwrapped deserializers.- Since:
- 3.1
-
processUnwrapped(JsonParser, DeserializationContext, Object, TokenBuffer, boolean)