Top Description Inners Constructors Methods
com.fasterxml.jackson.databind.ext

public Class CoreXMLSerializers

extends Base
Class Inheritance
Imports
java.io.IOException, java.util.Calendar, javax.xml.datatype.Duration, .XMLGregorianCalendar, javax.xml.namespace.QName, com.fasterxml.jackson.core.*, com.fasterxml.jackson.core.type.WritableTypeId, com.fasterxml.jackson.databind.*, com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatVisitorWrapper, com.fasterxml.jackson.databind.jsontype.TypeSerializer, com.fasterxml.jackson.databind.ser.ContextualSerializer, .Serializers, com.fasterxml.jackson.databind.ser.std.CalendarSerializer, .StdSerializer, .ToStringSerializer

Provider for serializers of XML types that are part of full JDK 1.5, but that some alleged 1.5 platforms are missing (Android, GAE). And for this reason these are added using more dynamic mechanism.

Note

since many of classes defined are abstract, caller must take care not to just use straight equivalency check but rather consider subclassing as well.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
CoreXMLSerializers.XMLGregorianCalendarSerializer

Deprecated as a consequence of StdSerializer being deprecated.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public JsonSerializer<?>
findSerializer(SerializationConfig
Serialization configuration in use
config
,
JavaType
Fully resolved type of instances to serialize
type
,
BeanDescription
Additional information about type
beanDesc
)

Overrides com.fasterxml.jackson.databind.ser.Serializers.Base.findSerializer.

Implements com.fasterxml.jackson.databind.ser.Serializers.findSerializer.

Method called by serialization framework first time a serializer is needed for specified type, which is not of a container or reference type (for which other methods are called).
Inherited from com.fasterxml.jackson.databind.ser.Serializers.Base:
findArraySerializerfindCollectionLikeSerializerfindCollectionSerializerfindMapLikeSerializerfindMapSerializerfindReferenceSerializer

Constructor Detail

CoreXMLSerializersback to summary
public CoreXMLSerializers()

Method Detail

findSerializerback to summary
public JsonSerializer<?> findSerializer(SerializationConfig config, JavaType type, BeanDescription beanDesc)

Overrides com.fasterxml.jackson.databind.ser.Serializers.Base.findSerializer.

Implements com.fasterxml.jackson.databind.ser.Serializers.findSerializer.

Doc from com.fasterxml.jackson.databind.ser.Serializers.findSerializer.

Method called by serialization framework first time a serializer is needed for specified type, which is not of a container or reference type (for which other methods are called).

Parameters
config:SerializationConfig

Serialization configuration in use

type:JavaType

Fully resolved type of instances to serialize

beanDesc:BeanDescription

Additional information about type

Returns:JsonSerializer<?>

Configured serializer to use for the type; or null if implementation does not recognize or support type

Annotations
@Override
com.fasterxml.jackson.databind.ext back to summary

public Class CoreXMLSerializers.XMLGregorianCalendarSerializer

extends StdSerializer<XMLGregorianCalendar>
implements ContextualSerializer
Class Inheritance
All Implemented Interfaces
com.fasterxml.jackson.databind.ser.ContextualSerializer
Annotations
@SuppressWarnings:serial

Deprecated

as a consequence of StdSerializer being deprecated. See corresponding docs for further information.

Field Summary

Modifier and TypeField and Description
pack-priv final JsonSerializer<Object>
pack-priv static final CoreXMLSerializers.XMLGregorianCalendarSerializer
instance

Deprecated as a consequence of CoreXMLSerializers.XMLGregorianCalendarSerializer being deprecated.
Inherited from com.fasterxml.jackson.databind.ser.std.StdSerializer:
_handledType

Constructor Summary

AccessConstructor and Description
public
protected

Method Summary

Modifier and TypeMethod and Description
protected Calendar
public void
public JsonSerializer<?>
createContextual(SerializerProvider
Serializer provider to use for accessing config, other serializers
prov
,
BeanProperty
Method or field that represents the property (and is used to access value to serialize). Should be available; but there may be cases where caller cannot provide it and null is passed instead (in which case impls usually pass 'this' serializer as is)
property
)

Implements com.fasterxml.jackson.databind.ser.ContextualSerializer.createContextual.

Method called to see if a different (or differently configured) serializer is needed to serialize values of specified property.
public JsonSerializer<?>
getDelegatee()

Overrides com.fasterxml.jackson.databind.JsonSerializer.getDelegatee.

Accessor that can be used to determine if this serializer uses another serializer for actual serialization, by delegating calls.
public boolean
isEmpty(SerializerProvider provider, XMLGregorianCalendar value)

Overrides com.fasterxml.jackson.databind.JsonSerializer.isEmpty.

Method called to check whether given serializable value is considered "empty" value (for purposes of suppressing serialization of empty values).
public void
serialize(XMLGregorianCalendar
Value to serialize; can not be null.
value
,
JsonGenerator
Generator used to output resulting Json content
gen
,
SerializerProvider
Provider that can be used to get serializers for serializing Objects value contains, if any.
provider
)

Implements abstract com.fasterxml.jackson.databind.ser.std.StdSerializer.serialize.

Method that can be called to ask implementation to serialize values of type this serializer handles.
public void
serializeWithType(XMLGregorianCalendar
Value to serialize; can not be null.
value
,
JsonGenerator
Generator used to output resulting Json content
g
,
SerializerProvider
Provider that can be used to get serializers for serializing Objects value contains, if any.
provider
,
TypeSerializer
Type serializer to use for including type information
typeSer
)

Overrides com.fasterxml.jackson.databind.JsonSerializer.serializeWithType.

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.
Inherited from com.fasterxml.jackson.databind.ser.std.StdSerializer:
_neitherNull_nonEmptycreateSchemaNodecreateSchemaNodefindAnnotatedContentSerializerfindContextualConvertingSerializerfindConvertingContentSerializerfindFormatFeaturefindFormatOverridesfindIncludeOverridesfindPropertyFiltergetSchemagetSchemahandledTypeisDefaultSerializervisitArrayFormatvisitArrayFormatvisitFloatFormatvisitIntFormatvisitIntFormatvisitStringFormatvisitStringFormatwrapAndThrowwrapAndThrow

Field Detail

_delegateback to summary
pack-priv final JsonSerializer<Object> _delegate
instanceback to summary
pack-priv static final CoreXMLSerializers.XMLGregorianCalendarSerializer instance

Deprecated

as a consequence of CoreXMLSerializers.XMLGregorianCalendarSerializer being deprecated. See corresponding docs for further information.

Constructor Detail

XMLGregorianCalendarSerializerback to summary
public XMLGregorianCalendarSerializer()
XMLGregorianCalendarSerializerback to summary
protected XMLGregorianCalendarSerializer(JsonSerializer<?> del)
Annotations
@SuppressWarnings:unchecked

Method Detail

_convertback to summary
protected Calendar _convert(XMLGregorianCalendar input)
acceptJsonFormatVisitorback to summary
public void acceptJsonFormatVisitor(JsonFormatVisitorWrapper visitor, JavaType typeHint) throws JsonMappingException

Overrides com.fasterxml.jackson.databind.ser.std.StdSerializer.acceptJsonFormatVisitor.

Implements com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatVisitable.acceptJsonFormatVisitor.

Doc from com.fasterxml.jackson.databind.ser.std.StdSerializer.acceptJsonFormatVisitor.

Default implementation specifies no format. This behavior is usually overriden by custom serializers.

Parameters
typeHint:JavaType

Doc from com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatVisitable.acceptJsonFormatVisitor.

Type of element (entity like property) being visited

Annotations
@Override
createContextualback to summary
public JsonSerializer<?> createContextual(SerializerProvider prov, BeanProperty property) throws JsonMappingException

Implements com.fasterxml.jackson.databind.ser.ContextualSerializer.createContextual.

Doc from com.fasterxml.jackson.databind.ser.ContextualSerializer.createContextual.

Method called to see if a different (or differently configured) serializer is needed to serialize values of specified property. Note that instance that this method is called on is typically shared one and as a result method should NOT modify this instance but rather construct and return a new instance. This instance should only be returned as-is, in case it is already suitable for use.

Parameters
prov:SerializerProvider

Serializer provider to use for accessing config, other serializers

property:BeanProperty

Method or field that represents the property (and is used to access value to serialize). Should be available; but there may be cases where caller cannot provide it and null is passed instead (in which case impls usually pass 'this' serializer as is)

Returns:JsonSerializer<?>

Serializer to use for serializing values of specified property; may be this instance or a new instance.

Annotations
@Override
getDelegateeback to summary
public JsonSerializer<?> getDelegatee()

Overrides com.fasterxml.jackson.databind.JsonSerializer.getDelegatee.

Doc from com.fasterxml.jackson.databind.JsonSerializer.getDelegatee.

Accessor that can be used to determine if this serializer uses another serializer for actual serialization, by delegating calls. If so, will return immediate delegate (which itself may delegate to further serializers); otherwise will return null.

Returns:JsonSerializer<?>

Serializer this serializer delegates calls to, if null; null otherwise.

Annotations
@Override
isEmptyback to summary
public boolean isEmpty(SerializerProvider provider, XMLGregorianCalendar value)

Overrides com.fasterxml.jackson.databind.JsonSerializer.isEmpty.

Doc from com.fasterxml.jackson.databind.JsonSerializer.isEmpty.

Method called to check whether given serializable value is considered "empty" value (for purposes of suppressing serialization of empty values).

Default implementation will consider only null values to be empty.

Note

replaces isEmpty(Object), which was deprecated in 2.5

Annotations
@Override
serializeback to summary
public void serialize(XMLGregorianCalendar value, JsonGenerator gen, SerializerProvider provider) throws IOException

Implements abstract com.fasterxml.jackson.databind.ser.std.StdSerializer.serialize.

Doc from com.fasterxml.jackson.databind.JsonSerializer.serialize.

Method that can be called to ask implementation to serialize values of type this serializer handles.

Parameters
value:XMLGregorianCalendar

Value to serialize; can not be null.

gen:JsonGenerator

Generator used to output resulting Json content

provider:SerializerProvider

Provider that can be used to get serializers for serializing Objects value contains, if any.

Annotations
@Override
serializeWithTypeback to summary
public void serializeWithType(XMLGregorianCalendar value, JsonGenerator g, SerializerProvider provider, TypeSerializer typeSer) throws IOException

Overrides com.fasterxml.jackson.databind.JsonSerializer.serializeWithType.

Doc from com.fasterxml.jackson.databind.JsonSerializer.serializeWithType.

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 UnsupportedOperationException to indicate that proper type handling needs to be implemented.

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.
Parameters
value:XMLGregorianCalendar

Value to serialize; can not be null.

g:JsonGenerator

Generator used to output resulting Json content

provider:SerializerProvider

Provider that can be used to get serializers for serializing Objects value contains, if any.

typeSer:TypeSerializer

Type serializer to use for including type information

Annotations
@Override