Package org.codehaus.jackson.map.ser.std
Class ObjectArraySerializer
- java.lang.Object
-
- org.codehaus.jackson.map.JsonSerializer<T>
-
- org.codehaus.jackson.map.ser.std.SerializerBase<T>
-
- org.codehaus.jackson.map.ser.std.ContainerSerializerBase<T>
-
- org.codehaus.jackson.map.ser.std.StdArraySerializers.ArraySerializerBase<java.lang.Object[]>
-
- org.codehaus.jackson.map.ser.std.ObjectArraySerializer
-
- All Implemented Interfaces:
ResolvableSerializer
,SchemaAware
public class ObjectArraySerializer extends StdArraySerializers.ArraySerializerBase<java.lang.Object[]> implements ResolvableSerializer
Generic serializer for Object arrays (Object[]
).- Since:
- 1.9 (moved from 'org.codehaus.jackson.map.ser.impl.ObjectArraySerializer')
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.codehaus.jackson.map.JsonSerializer
JsonSerializer.None
-
-
Field Summary
Fields Modifier and Type Field Description protected PropertySerializerMap
_dynamicSerializers
If element type can not be statically determined, mapping from runtime type to serializer is handled using this objectprotected JsonSerializer<java.lang.Object>
_elementSerializer
Value serializer to use, if it can be statically determined.protected JavaType
_elementType
Declared type of element entriesprotected 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.std.StdArraySerializers.ArraySerializerBase
_property, _valueTypeSerializer
-
Fields inherited from class org.codehaus.jackson.map.ser.std.SerializerBase
_handledType
-
-
Constructor Summary
Constructors Constructor Description ObjectArraySerializer(JavaType elemType, boolean staticTyping, TypeSerializer vts, BeanProperty property)
Deprecated.since 1.8ObjectArraySerializer(JavaType elemType, boolean staticTyping, TypeSerializer vts, BeanProperty property, JsonSerializer<java.lang.Object> elementSerializer)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected JsonSerializer<java.lang.Object>
_findAndAddDynamic(PropertySerializerMap map, java.lang.Class<?> type, SerializerProvider provider)
protected JsonSerializer<java.lang.Object>
_findAndAddDynamic(PropertySerializerMap map, JavaType type, SerializerProvider provider)
ContainerSerializerBase<?>
_withValueTypeSerializer(TypeSerializer vts)
JsonNode
getSchema(SerializerProvider provider, java.lang.reflect.Type typeHint)
Note: since Jackson 1.9, default implementation claims type is "string"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(java.lang.Object[] value, JsonGenerator jgen, SerializerProvider provider)
void
serializeContentsUsing(java.lang.Object[] value, JsonGenerator jgen, SerializerProvider provider, JsonSerializer<java.lang.Object> ser)
void
serializeTypedContents(java.lang.Object[] value, JsonGenerator jgen, SerializerProvider provider)
-
Methods inherited from class org.codehaus.jackson.map.ser.std.StdArraySerializers.ArraySerializerBase
serialize, serializeWithType
-
Methods inherited from class org.codehaus.jackson.map.ser.std.ContainerSerializerBase
withValueTypeSerializer
-
Methods inherited from class org.codehaus.jackson.map.ser.std.SerializerBase
createObjectNode, createSchemaNode, createSchemaNode, handledType, isDefaultSerializer, wrapAndThrow, wrapAndThrow, wrapAndThrow, wrapAndThrow
-
Methods inherited from class org.codehaus.jackson.map.JsonSerializer
isUnwrappingSerializer, unwrappingSerializer
-
-
-
-
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<java.lang.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<java.lang.Object> elementSerializer)
-
-
Method Detail
-
_withValueTypeSerializer
public ContainerSerializerBase<?> _withValueTypeSerializer(TypeSerializer vts)
- Specified by:
_withValueTypeSerializer
in classContainerSerializerBase<java.lang.Object[]>
-
serializeContents
public void serializeContents(java.lang.Object[] value, JsonGenerator jgen, SerializerProvider provider) throws java.io.IOException, JsonGenerationException
- Specified by:
serializeContents
in classStdArraySerializers.ArraySerializerBase<java.lang.Object[]>
- Throws:
java.io.IOException
JsonGenerationException
-
serializeContentsUsing
public void serializeContentsUsing(java.lang.Object[] value, JsonGenerator jgen, SerializerProvider provider, JsonSerializer<java.lang.Object> ser) throws java.io.IOException, JsonGenerationException
- Throws:
java.io.IOException
JsonGenerationException
-
serializeTypedContents
public void serializeTypedContents(java.lang.Object[] value, JsonGenerator jgen, SerializerProvider provider) throws java.io.IOException, JsonGenerationException
- Throws:
java.io.IOException
JsonGenerationException
-
getSchema
public JsonNode getSchema(SerializerProvider provider, java.lang.reflect.Type typeHint) throws JsonMappingException
Description copied from class:SerializerBase
Note: since Jackson 1.9, default implementation claims type is "string"- Specified by:
getSchema
in interfaceSchemaAware
- Overrides:
getSchema
in classSerializerBase<java.lang.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 interfaceResolvableSerializer
- Parameters:
provider
- Provider that has constructed serializer this method is called on.- Throws:
JsonMappingException
-
_findAndAddDynamic
protected final JsonSerializer<java.lang.Object> _findAndAddDynamic(PropertySerializerMap map, java.lang.Class<?> type, SerializerProvider provider) throws JsonMappingException
- Throws:
JsonMappingException
- Since:
- 1.7
-
_findAndAddDynamic
protected final JsonSerializer<java.lang.Object> _findAndAddDynamic(PropertySerializerMap map, JavaType type, SerializerProvider provider) throws JsonMappingException
- Throws:
JsonMappingException
- Since:
- 1.8
-
-