public class BeanSerializer extends BeanSerializerBase
Implementation note: we will post-process resulting serializer,
to figure out actual serializers for final types. This must be
done from BeanSerializerBase.resolve(org.codehaus.jackson.map.SerializerProvider)
method, and NOT from constructor;
otherwise we could end up with an infinite loop.
Since 1.7 instances are immutable; this is achieved by using a separate builder during construction process.
JsonSerializer.None
_anyGetterWriter, _filteredProps, _propertyFilterId, _props, NO_PROPS
_handledType
Modifier | Constructor and Description |
---|---|
protected |
BeanSerializer(BeanSerializer src)
Copy-constructor that is useful for sub-classes that just want to
copy all super-class properties without modifications.
|
protected |
BeanSerializer(BeanSerializerBase src)
Alternate copy constructor that can be used to construct
standard
BeanSerializer passing an instance of
"compatible enough" source serializer. |
|
BeanSerializer(Class<?> rawType,
BeanPropertyWriter[] properties,
BeanPropertyWriter[] filteredProperties,
AnyGetterWriter anyGetterWriter,
Object filterId) |
|
BeanSerializer(JavaType type,
BeanPropertyWriter[] properties,
BeanPropertyWriter[] filteredProperties,
AnyGetterWriter anyGetterWriter,
Object filterId) |
Modifier and Type | Method and Description |
---|---|
static BeanSerializer |
createDummy(Class<?> forType)
Method for constructing dummy bean deserializer; one that
never outputs any properties
|
void |
serialize(Object bean,
JsonGenerator jgen,
SerializerProvider provider)
Main serialization method that will delegate actual output to
configured
BeanPropertyWriter instances. |
String |
toString() |
JsonSerializer<Object> |
unwrappingSerializer()
Method that will return serializer instance that produces
"unwrapped" serialization, if applicable for type being
serialized (which is the case for some serializers
that produce JSON Objects as output).
|
findFilter, getSchema, resolve, serializeFields, serializeFieldsFiltered, serializeWithType
createObjectNode, createSchemaNode, createSchemaNode, handledType, isDefaultSerializer, wrapAndThrow, wrapAndThrow, wrapAndThrow, wrapAndThrow
isUnwrappingSerializer
public BeanSerializer(JavaType type, BeanPropertyWriter[] properties, BeanPropertyWriter[] filteredProperties, AnyGetterWriter anyGetterWriter, Object filterId)
type
- Nominal type of values handled by this serializerproperties
- Property writers used for actual serializationpublic BeanSerializer(Class<?> rawType, BeanPropertyWriter[] properties, BeanPropertyWriter[] filteredProperties, AnyGetterWriter anyGetterWriter, Object filterId)
protected BeanSerializer(BeanSerializer src)
protected BeanSerializer(BeanSerializerBase src)
BeanSerializer
passing an instance of
"compatible enough" source serializer.public static BeanSerializer createDummy(Class<?> forType)
public JsonSerializer<Object> unwrappingSerializer()
JsonSerializer
Default implementation just returns serializer as-is, indicating that no unwrapped variant exists
unwrappingSerializer
in class JsonSerializer<Object>
public final void serialize(Object bean, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonGenerationException
BeanPropertyWriter
instances.serialize
in class BeanSerializerBase
bean
- Value to serialize; can not be null.jgen
- Generator used to output resulting Json contentprovider
- Provider that can be used to get serializers for
serializing Objects value contains, if any.IOException
JsonGenerationException