BeanAsArraySerializer, optimized for handling
small number of properties where calls to property handlers can be
"unrolled" by eliminated looping. This can help optimize execution
significantly for some backends.
| Modifier and Type | Field and Description |
|---|---|
| protected final BeanSerializerBase | _defaultSerializer
Serializer that would produce JSON Object version; used in cases where array output cannot be used. |
| protected BeanPropertyWriter | |
| protected BeanPropertyWriter | |
| protected BeanPropertyWriter | |
| protected BeanPropertyWriter | |
| protected BeanPropertyWriter | |
| protected BeanPropertyWriter | |
| protected final int | |
| public static final int |
| Access | Constructor and Description |
|---|---|
| public | |
| protected |
| Modifier and Type | Method and Description |
|---|---|
| private void | |
| protected BeanSerializerBase | asArraySerializer()
Implements abstract tools. Mutant factory for creating a variant that output POJO as a JSON Array. |
| private boolean | |
| public boolean | isUnwrappingSerializer()
Overrides tools. Accessor for checking whether this serializer is an "unwrapping" serializer; this is necessary to know since it may also require caller to suppress writing of the leading property name. |
| public void | resolve(SerializationContext provider)
Overrides tools. We need to resolve dependant serializers here to be able to properly handle cyclic type references. |
| public final void | serialize(Object bean, JsonGenerator gen, SerializationContext provider)
Implements abstract tools. Main serialization method that will delegate actual output to
configured
|
| protected final void | |
| public void | serializeWithType(Object bean, JsonGenerator gen, SerializationContext ctxt, TypeSerializer typeSer)
Overrides tools. Method that can be called to ask implementation to serialize values of type this serializer handles, using specified type serializer for embedding necessary type information. |
| public static UnrolledBeanAsArraySerializer | tryConstruct(BeanSerializerBase src)
Factory method that will construct optimized instance if all the constraints are obeyed; or, if not, return `null` to indicate that instance cannot be created. |
| public ValueSerializer | unwrappingSerializer(NameTransformer transformer)
Implements abstract tools. Lets force sub-classes to implement this, to avoid accidental missing of handling... |
| protected UnrolledBeanAsArraySerializer | withByNameInclusion(Set<String> toIgnore, Set<String> toInclude)
Implements abstract tools. Mutant factory used for creating a new instance with additional set of properties to ignore or include (from properties this instance otherwise has) |
| public BeanSerializerBase | withFilterId(Object filterId)
Implements abstract tools. Mutant factory used for creating a new instance with different
filter id (used with |
| public BeanSerializerBase | withObjectIdWriter(ObjectIdWriter objectIdWriter)
Implements abstract tools. Mutant factory used for creating a new instance with different
|
| protected BeanSerializerBase | withProperties(BeanPropertyWriter[] properties, BeanPropertyWriter[] filteredProperties)
Implements abstract tools. Mutant factory used for creating a new instance with modified set of properties |
| _defaultSerializer | back to summary |
|---|---|
| protected final BeanSerializerBase _defaultSerializer Serializer that would produce JSON Object version; used in cases where array output cannot be used. | |
| _prop1 | back to summary |
|---|---|
| protected BeanPropertyWriter _prop1 | |
| _prop2 | back to summary |
|---|---|
| protected BeanPropertyWriter _prop2 | |
| _prop3 | back to summary |
|---|---|
| protected BeanPropertyWriter _prop3 | |
| _prop4 | back to summary |
|---|---|
| protected BeanPropertyWriter _prop4 | |
| _prop5 | back to summary |
|---|---|
| protected BeanPropertyWriter _prop5 | |
| _prop6 | back to summary |
|---|---|
| protected BeanPropertyWriter _prop6 | |
| _propCount | back to summary |
|---|---|
| protected final int _propCount | |
| MAX_PROPS | back to summary |
|---|---|
| public static final int MAX_PROPS | |
| UnrolledBeanAsArraySerializer | back to summary |
|---|---|
| public UnrolledBeanAsArraySerializer(BeanSerializerBase src) | |
| UnrolledBeanAsArraySerializer | back to summary |
|---|---|
| protected UnrolledBeanAsArraySerializer(BeanSerializerBase src, Set<String> toIgnore, Set<String> toInclude) | |
| _calcUnrolled | back to summary |
|---|---|
| private void _calcUnrolled() | |
| asArraySerializer | back to summary |
|---|---|
| protected BeanSerializerBase asArraySerializer() Implements abstract tools. Doc from tools. Mutant factory for creating a variant that output POJO as a JSON Array. Implementations may ignore this request if output as array is not possible (either at all, or reliably).
| |
| hasSingleElement | back to summary |
|---|---|
| private boolean hasSingleElement(SerializationContext provider) | |
| isUnwrappingSerializer | back to summary |
|---|---|
| public boolean isUnwrappingSerializer() Overrides tools. Doc from tools. Accessor for checking whether this serializer is an "unwrapping" serializer; this is necessary to know since it may also require caller to suppress writing of the leading property name.
| |
| resolve | back to summary |
|---|---|
| public void resolve(SerializationContext provider) Overrides tools. Doc from tools. We need to resolve dependant serializers here to be able to properly handle cyclic type references.
| |
| serialize | back to summary |
|---|---|
| public final void serialize(Object bean, JsonGenerator gen, SerializationContext provider) throws JacksonException Implements abstract tools. Main serialization method that will delegate actual output to
configured
| |
| serializeNonFiltered | back to summary |
|---|---|
| protected final void serializeNonFiltered(Object bean, JsonGenerator gen, SerializationContext provider) throws JacksonException | |
| serializeWithType | back to summary |
|---|---|
| public void serializeWithType(Object bean, JsonGenerator gen, SerializationContext ctxt, TypeSerializer typeSer) throws JacksonException Overrides tools. Doc from tools. Method that can be called to ask implementation to serialize values of type this serializer handles, using specified type serializer for embedding necessary type information.
Default implementation will throw For simple datatypes written as a single scalar value (JSON String, Number, Boolean), implementation would look like: // note: method to call depends on whether this type is serialized as JSON scalar, object or Array! typeSer.writeTypePrefixForScalar(value, gen); serialize(value, gen, provider); typeSer.writeTypeSuffixForScalar(value, gen);and implementations for type serialized as JSON Arrays or Objects would differ slightly, as START-ARRAY/END-ARRAY and
START-OBJECT/END-OBJECT pairs
need to be properly handled with respect to serializing of contents.
| |
| tryConstruct | back to summary |
|---|---|
| public static UnrolledBeanAsArraySerializer tryConstruct(BeanSerializerBase src) Factory method that will construct optimized instance if all the constraints are obeyed; or, if not, return `null` to indicate that instance cannot be created. | |
| unwrappingSerializer | back to summary |
|---|---|
| public ValueSerializer Implements abstract tools. Doc from tools. Lets force sub-classes to implement this, to avoid accidental missing of handling...
| |
| withByNameInclusion | back to summary |
|---|---|
| protected UnrolledBeanAsArraySerializer withByNameInclusion(Set<String> toIgnore, Set<String> toInclude) Implements abstract tools. Doc from tools. Mutant factory used for creating a new instance with additional set of properties to ignore or include (from properties this instance otherwise has)
| |
| withFilterId | back to summary |
|---|---|
| public BeanSerializerBase withFilterId(Object filterId) Implements abstract tools. Doc from tools. Mutant factory used for creating a new instance with different
filter id (used with
| |
| withObjectIdWriter | back to summary |
|---|---|
| public BeanSerializerBase withObjectIdWriter(ObjectIdWriter objectIdWriter) Implements abstract tools. Doc from tools. Mutant factory used for creating a new instance with different
| |
| withProperties | back to summary |
|---|---|
| protected BeanSerializerBase withProperties(BeanPropertyWriter[] properties, BeanPropertyWriter[] filteredProperties) Implements abstract tools. Doc from tools. Mutant factory used for creating a new instance with modified set of properties
| |