Class UnwrappingBeanPropertyWriter
java.lang.Object
com.fasterxml.jackson.databind.introspect.ConcreteBeanPropertyBase
com.fasterxml.jackson.databind.ser.PropertyWriter
com.fasterxml.jackson.databind.ser.BeanPropertyWriter
com.fasterxml.jackson.databind.ser.impl.UnwrappingBeanPropertyWriter
- All Implemented Interfaces:
BeanProperty, Named, Serializable
Variant of
BeanPropertyWriter which will handle unwrapping
of JSON Object (including of properties of Object within surrounding
JSON object, and not as sub-object).- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface BeanProperty
BeanProperty.Bogus, BeanProperty.Std -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final NameTransformerTransformer used to add prefix and/or suffix for properties of unwrapped POJO.Fields inherited from class BeanPropertyWriter
_accessorMethod, _cfgSerializationType, _contextAnnotations, _declaredType, _dynamicSerializers, _field, _includeInViews, _internalSettings, _member, _name, _nonTrivialBaseType, _nullSerializer, _serializer, _suppressableValue, _suppressNulls, _typeSerializer, _wrapperName, MARKER_FOR_EMPTYFields inherited from class ConcreteBeanPropertyBase
_aliases, _metadataFields inherited from interface BeanProperty
EMPTY_FORMAT, EMPTY_INCLUDE -
Constructor Summary
ConstructorsModifierConstructorDescriptionUnwrappingBeanPropertyWriter(BeanPropertyWriter base, NameTransformer unwrapper) protectedUnwrappingBeanPropertyWriter(UnwrappingBeanPropertyWriter base, NameTransformer transformer, com.fasterxml.jackson.core.io.SerializedString name) -
Method Summary
Modifier and TypeMethodDescriptionprotected void_depositSchemaProperty(ObjectNode propertiesNode, JsonNode schemaNode) protected JsonSerializer<Object> _findAndAddDynamic(PropertySerializerMap map, Class<?> type, SerializerProvider provider) protected UnwrappingBeanPropertyWriter_new(NameTransformer transformer, com.fasterxml.jackson.core.io.SerializedString newName) Overridable factory method used by sub-classesvoidMethod called to assign value serializer for propertyvoiddepositSchemaProperty(JsonObjectFormatVisitor visitor, SerializerProvider provider) Traversal method used for things like JSON Schema generation, or POJO introspection.booleanAccessor that will return true if this bean property has to support "unwrapping"; ability to replace POJO structural wrapping with optional name prefix and/or suffix (or in some cases, just removal of wrapper name).rename(NameTransformer transformer) voidserializeAsField(Object bean, com.fasterxml.jackson.core.JsonGenerator gen, SerializerProvider prov) Method called to access property that this bean stands for, from within given bean, and to serialize it as a JSON Object field using appropriate serializer.Methods inherited from class BeanPropertyWriter
_handleSelfReference, _new, assignNullSerializer, assignTypeSerializer, depositSchemaProperty, fixAccess, get, getAnnotation, getContextAnnotation, getFullName, getGenericPropertyType, getInternalSetting, getMember, getName, getPropertyType, getRawSerializationType, getSerializationType, getSerializedName, getSerializer, getType, getTypeSerializer, getViews, getWrapperName, hasNullSerializer, hasSerializer, removeInternalSetting, serializeAsElement, serializeAsOmittedField, serializeAsPlaceholder, setInternalSetting, setNonTrivialBaseType, toString, unwrappingWriter, willSuppressNulls, wouldConflictWithNameMethods inherited from class PropertyWriter
findAnnotationMethods inherited from class ConcreteBeanPropertyBase
findAliases, findFormatOverrides, findPropertyFormat, findPropertyInclusion, getMetadata, isRequired, isVirtual
-
Field Details
-
_nameTransformer
Transformer used to add prefix and/or suffix for properties of unwrapped POJO.
-
-
Constructor Details
-
UnwrappingBeanPropertyWriter
-
UnwrappingBeanPropertyWriter
protected UnwrappingBeanPropertyWriter(UnwrappingBeanPropertyWriter base, NameTransformer transformer, com.fasterxml.jackson.core.io.SerializedString name)
-
-
Method Details
-
rename
- Overrides:
renamein classBeanPropertyWriter
-
_new
protected UnwrappingBeanPropertyWriter _new(NameTransformer transformer, com.fasterxml.jackson.core.io.SerializedString newName) Overridable factory method used by sub-classes- Since:
- 2.6.0
-
isUnwrapping
public boolean isUnwrapping()Description copied from class:BeanPropertyWriterAccessor that will return true if this bean property has to support "unwrapping"; ability to replace POJO structural wrapping with optional name prefix and/or suffix (or in some cases, just removal of wrapper name).Default implementation simply returns false.
- Overrides:
isUnwrappingin classBeanPropertyWriter
-
serializeAsField
public void serializeAsField(Object bean, com.fasterxml.jackson.core.JsonGenerator gen, SerializerProvider prov) throws Exception Description copied from class:BeanPropertyWriterMethod called to access property that this bean stands for, from within given bean, and to serialize it as a JSON Object field using appropriate serializer.- Overrides:
serializeAsFieldin classBeanPropertyWriter- Throws:
Exception
-
assignSerializer
Description copied from class:BeanPropertyWriterMethod called to assign value serializer for property- Overrides:
assignSerializerin classBeanPropertyWriter
-
depositSchemaProperty
public void depositSchemaProperty(JsonObjectFormatVisitor visitor, SerializerProvider provider) throws JsonMappingException Description copied from class:PropertyWriterTraversal method used for things like JSON Schema generation, or POJO introspection.- Specified by:
depositSchemaPropertyin interfaceBeanProperty- Overrides:
depositSchemaPropertyin classBeanPropertyWriter- Parameters:
visitor- Visitor to used as the callback handler- Throws:
JsonMappingException
-
_depositSchemaProperty
- Overrides:
_depositSchemaPropertyin classBeanPropertyWriter
-
_findAndAddDynamic
protected JsonSerializer<Object> _findAndAddDynamic(PropertySerializerMap map, Class<?> type, SerializerProvider provider) throws JsonMappingException - Overrides:
_findAndAddDynamicin classBeanPropertyWriter- Throws:
JsonMappingException
-