org.codehaus.jackson.map.ser.impl
Class ObjectArraySerializer

java.lang.Object
  extended by org.codehaus.jackson.map.JsonSerializer<T>
      extended by org.codehaus.jackson.map.ser.SerializerBase<T>
          extended by org.codehaus.jackson.map.ser.ContainerSerializerBase<T>
              extended by org.codehaus.jackson.map.ser.ArraySerializers.AsArraySerializer<Object[]>
                  extended by org.codehaus.jackson.map.ser.impl.ObjectArraySerializer
All Implemented Interfaces:
ResolvableSerializer, SchemaAware

public class ObjectArraySerializer
extends ArraySerializers.AsArraySerializer<Object[]>
implements ResolvableSerializer

Generic serializer for Object arrays (Object[]).


Nested Class Summary
 
Nested classes/interfaces inherited from class org.codehaus.jackson.map.JsonSerializer
JsonSerializer.None
 
Field Summary
protected  PropertySerializerMap _dynamicSerializers
          If element type can not be statically determined, mapping from runtime type to serializer is handled using this object
protected  JsonSerializer<Object> _elementSerializer
          Value serializer to use, if it can be statically determined.
protected  JavaType _elementType
          Declared type of element entries
protected  boolean _staticTyping
          Whether we are using static typing (using declared types, ignoring runtime type) or not for elements.
 
Fields inherited from class org.codehaus.jackson.map.ser.ArraySerializers.AsArraySerializer
_property, _valueTypeSerializer
 
Fields inherited from class org.codehaus.jackson.map.ser.SerializerBase
_handledType
 
Constructor Summary
ObjectArraySerializer(JavaType elemType, boolean staticTyping, TypeSerializer vts, BeanProperty property)
          Deprecated. since 1.8
ObjectArraySerializer(JavaType elemType, boolean staticTyping, TypeSerializer vts, BeanProperty property, JsonSerializer<Object> elementSerializer)
           
 
Method Summary
protected  JsonSerializer<Object> _findAndAddDynamic(PropertySerializerMap map, Class<?> type, SerializerProvider provider)
           
protected  JsonSerializer<Object> _findAndAddDynamic(PropertySerializerMap map, JavaType type, SerializerProvider provider)
           
 ContainerSerializerBase<?> _withValueTypeSerializer(TypeSerializer vts)
           
 JsonNode getSchema(SerializerProvider provider, Type typeHint)
          Get the representation of the schema to which this serializer will conform.
 void resolve(SerializerProvider provider)
          Need to get callback to resolve value serializer, if static typing is used (either being forced, or because value type is final)
 void serializeContents(Object[] value, JsonGenerator jgen, SerializerProvider provider)
           
 void serializeContentsUsing(Object[] value, JsonGenerator jgen, SerializerProvider provider, JsonSerializer<Object> ser)
           
 void serializeTypedContents(Object[] value, JsonGenerator jgen, SerializerProvider provider)
           
 
Methods inherited from class org.codehaus.jackson.map.ser.ArraySerializers.AsArraySerializer
serialize, serializeWithType
 
Methods inherited from class org.codehaus.jackson.map.ser.ContainerSerializerBase
withValueTypeSerializer
 
Methods inherited from class org.codehaus.jackson.map.ser.SerializerBase
createObjectNode, createSchemaNode, createSchemaNode, handledType, isDefaultSerializer, wrapAndThrow, wrapAndThrow, wrapAndThrow, wrapAndThrow
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_staticTyping

protected final boolean _staticTyping
Whether we are using static typing (using declared types, ignoring runtime type) or not for elements.


_elementType

protected final JavaType _elementType
Declared type of element entries


_elementSerializer

protected JsonSerializer<Object> _elementSerializer
Value serializer to use, if it can be statically determined.

Since:
1.5

_dynamicSerializers

protected PropertySerializerMap _dynamicSerializers
If element type can not be statically determined, mapping from runtime type to serializer is handled using this object

Since:
1.7
Constructor Detail

ObjectArraySerializer

@Deprecated
public ObjectArraySerializer(JavaType elemType,
                                        boolean staticTyping,
                                        TypeSerializer vts,
                                        BeanProperty property)
Deprecated. since 1.8


ObjectArraySerializer

public ObjectArraySerializer(JavaType elemType,
                             boolean staticTyping,
                             TypeSerializer vts,
                             BeanProperty property,
                             JsonSerializer<Object> elementSerializer)
Method Detail

_withValueTypeSerializer

public ContainerSerializerBase<?> _withValueTypeSerializer(TypeSerializer vts)
Specified by:
_withValueTypeSerializer in class ContainerSerializerBase<Object[]>

serializeContents

public void serializeContents(Object[] value,
                              JsonGenerator jgen,
                              SerializerProvider provider)
                       throws IOException,
                              JsonGenerationException
Specified by:
serializeContents in class ArraySerializers.AsArraySerializer<Object[]>
Throws:
IOException
JsonGenerationException

serializeContentsUsing

public void serializeContentsUsing(Object[] value,
                                   JsonGenerator jgen,
                                   SerializerProvider provider,
                                   JsonSerializer<Object> ser)
                            throws IOException,
                                   JsonGenerationException
Throws:
IOException
JsonGenerationException

serializeTypedContents

public void serializeTypedContents(Object[] value,
                                   JsonGenerator jgen,
                                   SerializerProvider provider)
                            throws IOException,
                                   JsonGenerationException
Throws:
IOException
JsonGenerationException

getSchema

public JsonNode getSchema(SerializerProvider provider,
                          Type typeHint)
                   throws JsonMappingException
Description copied from interface: SchemaAware
Get the representation of the schema to which this serializer will conform.

Specified by:
getSchema in interface SchemaAware
Specified by:
getSchema in class SerializerBase<Object[]>
Parameters:
provider - The serializer provider.
typeHint - A hint about the type.
Returns:
Json-schema for this serializer.
Throws:
JsonMappingException

resolve

public void resolve(SerializerProvider provider)
             throws JsonMappingException
Need to get callback to resolve value serializer, if static typing is used (either being forced, or because value type is final)

Specified by:
resolve in interface ResolvableSerializer
Parameters:
provider - Provider that has constructed serializer this method is called on.
Throws:
JsonMappingException

_findAndAddDynamic

protected final JsonSerializer<Object> _findAndAddDynamic(PropertySerializerMap map,
                                                          Class<?> type,
                                                          SerializerProvider provider)
                                                   throws JsonMappingException
Throws:
JsonMappingException
Since:
1.7

_findAndAddDynamic

protected final JsonSerializer<Object> _findAndAddDynamic(PropertySerializerMap map,
                                                          JavaType type,
                                                          SerializerProvider provider)
                                                   throws JsonMappingException
Throws:
JsonMappingException
Since:
1.8