|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.codehaus.jackson.map.JsonSerializer<T>
org.codehaus.jackson.map.ser.SerializerBase<Object>
org.codehaus.jackson.map.ser.BeanSerializer
public class BeanSerializer
Serializer class that can serialize arbitrary bean objects.
Implementation note: we will post-process resulting serializer,
to figure out actual serializers for final types. This must be
done from resolve(org.codehaus.jackson.map.SerializerProvider)
method, and NOT from constructor;
otherwise we could end up with an infinite loop.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class org.codehaus.jackson.map.JsonSerializer |
---|
JsonSerializer.None |
Field Summary | |
---|---|
protected Class<?> |
_class
Value type of this serializer, used for error reporting and debugging. |
protected BeanPropertyWriter[] |
_filteredProps
Optional filters used to suppress output of properties that are only to be included in certain views |
protected BeanPropertyWriter[] |
_props
Writers used for outputting actual property values |
Constructor Summary | |
---|---|
BeanSerializer(Class<?> type,
BeanPropertyWriter[] writers)
|
|
BeanSerializer(Class<?> type,
BeanPropertyWriter[] props,
BeanPropertyWriter[] fprops)
Alternate constructor used when class being serialized can have dynamically enabled Json Views |
|
BeanSerializer(Class<?> type,
Collection<BeanPropertyWriter> props)
|
Method Summary | |
---|---|
static BeanSerializer |
createDummy(Class<?> forType)
Method for constructing dummy bean deserializer; one that never outputs any properties |
JsonNode |
getSchema(SerializerProvider provider,
Type typeHint)
Get the representation of the schema to which this serializer will conform. |
void |
resolve(SerializerProvider provider)
Method called after SerializerProvider has registered
the serializer, but before it has returned it to the caller. |
void |
serialize(Object bean,
JsonGenerator jgen,
SerializerProvider provider)
Method that can be called to ask implementation to serialize values of type this serializer handles. |
String |
toString()
|
BeanSerializer |
withFiltered(BeanPropertyWriter[] filtered)
Method used for constructing a filtered serializer instance, using this serializer as the base. |
Methods inherited from class org.codehaus.jackson.map.ser.SerializerBase |
---|
createObjectNode, createSchemaNode, createSchemaNode, wrapAndThrow, wrapAndThrow |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected final Class<?> _class
protected final BeanPropertyWriter[] _props
protected final BeanPropertyWriter[] _filteredProps
Constructor Detail |
---|
public BeanSerializer(Class<?> type, BeanPropertyWriter[] writers)
type
- Nominal type of values handled by this serializerwriters
- Property writers used for actual serializationpublic BeanSerializer(Class<?> type, BeanPropertyWriter[] props, BeanPropertyWriter[] fprops)
fprops
- Filtered property writers to use when there is
an active view.public BeanSerializer(Class<?> type, Collection<BeanPropertyWriter> props)
Method Detail |
---|
public static BeanSerializer createDummy(Class<?> forType)
public BeanSerializer withFiltered(BeanPropertyWriter[] filtered)
public void serialize(Object bean, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonGenerationException
JsonSerializer
serialize
in class SerializerBase<Object>
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
public JsonNode getSchema(SerializerProvider provider, Type typeHint) throws JsonMappingException
SchemaAware
getSchema
in interface SchemaAware
getSchema
in class SerializerBase<Object>
provider
- The serializer provider.typeHint
- A hint about the type.
JsonMappingException
public void resolve(SerializerProvider provider) throws JsonMappingException
ResolvableSerializer
SerializerProvider
has registered
the serializer, but before it has returned it to the caller.
Called object can then resolve its dependencies to other types,
including self-references (direct or indirect).
resolve
in interface ResolvableSerializer
provider
- Provider that has constructed serializer this method
is called on.
JsonMappingException
public String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |