Top Description Fields Constructors Methods
com.fasterxml.jackson.datatype.joda.ser

public Class PeriodSerializer

extends JodaSerializerBase<ReadablePeriod>
implements ContextualSerializer
Class Inheritance
All Implemented Interfaces
com.fasterxml.jackson.databind.ser.ContextualSerializer
Imports
java.io.IOException, org.joda.time.ReadablePeriod, com.fasterxml.jackson.annotation.JsonFormat, com.fasterxml.jackson.core.JsonGenerator, com.fasterxml.jackson.databind.*, com.fasterxml.jackson.databind.jsonFormatVisitors.*, com.fasterxml.jackson.databind.ser.ContextualSerializer, com.fasterxml.jackson.datatype.joda.cfg.FormatConfig, .JacksonJodaPeriodFormat

References Deprecated

JodaSerializerBase is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

Serializes a ReadablePeriod using Joda default formatting.

Todo

allow serialization as an array of numbers, for numeric ("timestamp") notation?

Field Summary

Modifier and TypeField and Description
protected final JacksonJodaPeriodFormat
private static final long

Constructor Summary

AccessConstructor and Description
public
protected

Method Summary

Modifier and TypeMethod and Description
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 JsonNode
getSchema(SerializerProvider
The serializer provider.
provider
,
Type
A hint about the type.
typeHint
)

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

Implements com.fasterxml.jackson.databind.jsonschema.SchemaAware.getSchema.

Deprecated

Default implementation simply claims type is "string"; usually overriden by custom serializers.

public void
serialize(ReadablePeriod
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.

Inherited from com.fasterxml.jackson.datatype.joda.ser.JodaSerializerBase:
serializeWithType

Field Detail

_formatback to summary
protected final JacksonJodaPeriodFormat _format
serialVersionUIDback to summary
private static final long serialVersionUID

Hides com.fasterxml.jackson.datatype.joda.ser.JodaSerializerBase.serialVersionUID.

Constructor Detail

PeriodSerializerback to summary
public PeriodSerializer()
PeriodSerializerback to summary
protected PeriodSerializer(JacksonJodaPeriodFormat format)

Method Detail

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
getSchemaback to summary
public JsonNode getSchema(SerializerProvider provider, Type typeHint)

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

Implements com.fasterxml.jackson.databind.jsonschema.SchemaAware.getSchema.

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

Deprecated

Default implementation simply claims type is "string"; usually overriden by custom serializers.

Parameters
provider:SerializerProvider

Doc from com.fasterxml.jackson.databind.jsonschema.SchemaAware.getSchema.

The serializer provider.

typeHint:Type

Doc from com.fasterxml.jackson.databind.jsonschema.SchemaAware.getSchema.

A hint about the type.

Returns:JsonNode

Doc from com.fasterxml.jackson.databind.jsonschema.SchemaAware.getSchema.

Json-schema for this serializer.

Annotations
@Override
@Deprecated
serializeback to summary
public void serialize(ReadablePeriod 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:ReadablePeriod

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