Top Fields Constructors Methods
tools.jackson.datatype.javax.money

pack-priv final Class MonetaryAmountSerializer

extends StdSerializer<MonetaryAmount>
Class Inheritance
Imports
java.util.Locale, javax.money.CurrencyUnit, .MonetaryAmount, javax.money.format.MonetaryAmountFormat, tools.jackson.core.JsonGenerator, tools.jackson.databind.JavaType, .ValueSerializer, .SerializationContext, tools.jackson.databind.jsonFormatVisitors.JsonFormatVisitorWrapper, .JsonObjectFormatVisitor, tools.jackson.databind.jsontype.TypeSerializer, tools.jackson.databind.ser.std.StdSerializer, tools.jackson.databind.util.NameTransformer

Field Summary

Modifier and TypeField and Description
private final MonetaryAmountFormatFactory
private final boolean
private final FieldNames
private final NameTransformer
private final AmountWriter<?>
Inherited from tools.jackson.databind.ser.std.StdSerializer:
_handledType

Constructor Summary

AccessConstructor and Description
pack-priv
MonetaryAmountSerializer(final FieldNames names, final AmountWriter<?> writer, final MonetaryAmountFormatFactory factory, boolean isUnwrapping, final NameTransformer nameTransformer)

pack-priv
MonetaryAmountSerializer(final FieldNames names, final AmountWriter<?> writer, final MonetaryAmountFormatFactory factory)

Method Summary

Modifier and TypeMethod and Description
public void
private String
format(final MonetaryAmount value, final SerializationContext ctxt)

public boolean
isUnwrappingSerializer()

Overrides tools.jackson.databind.ValueSerializer.isUnwrappingSerializer.

Accessor for checking whether this serializer is an "unwrapping" serializer; this is necessary to know since it may also require caller to suppress writing of the leading property name.

public void
serialize(final MonetaryAmount value, final JsonGenerator json, final SerializationContext ctxt)

Implements abstract tools.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(final MonetaryAmount value, final JsonGenerator generator, final SerializationContext provider, final TypeSerializer serializer)

Overrides tools.jackson.databind.ValueSerializer.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.

private String
public ValueSerializer<MonetaryAmount>
unwrappingSerializer(final NameTransformer nameTransformer)

Overrides tools.jackson.databind.ValueSerializer.unwrappingSerializer.

Method that will return serializer instance that produces "unwrapped" serialization, if applicable for type being serialized (which is the case for some serializers that produce JSON Objects as output).

Inherited from tools.jackson.databind.ser.std.StdSerializer:
_neitherNull_nonEmpty_wrapIOFailureacceptJsonFormatVisitorForBinarycreateSchemaNodecreateSchemaNodefindAnnotatedContentSerializerfindContextualConvertingSerializerfindFormatFeaturefindFormatOverridesfindIncludeOverridesfindPropertyFilterhandledTypeisDefaultSerializervisitArrayFormatvisitArrayFormatvisitFloatFormatvisitIntFormatvisitIntFormatvisitStringFormatvisitStringFormatwrapAndThrowwrapAndThrow

Field Detail

factoryback to summary
private final MonetaryAmountFormatFactory factory
isUnwrappingback to summary
private final boolean isUnwrapping
namesback to summary
private final FieldNames names
nameTransformerback to summary
private final NameTransformer nameTransformer
writerback to summary
private final AmountWriter<?> writer

Constructor Detail

MonetaryAmountSerializerback to summary
pack-priv MonetaryAmountSerializer(final FieldNames names, final AmountWriter<?> writer, final MonetaryAmountFormatFactory factory, boolean isUnwrapping, final NameTransformer nameTransformer)
MonetaryAmountSerializerback to summary
pack-priv MonetaryAmountSerializer(final FieldNames names, final AmountWriter<?> writer, final MonetaryAmountFormatFactory factory)

Method Detail

acceptJsonFormatVisitorback to summary
public void acceptJsonFormatVisitor(final JsonFormatVisitorWrapper wrapper, final JavaType hint)

Overrides tools.jackson.databind.ser.std.StdSerializer.acceptJsonFormatVisitor.

Implements tools.jackson.databind.jsonFormatVisitors.JsonFormatVisitable.acceptJsonFormatVisitor.

Doc from tools.jackson.databind.ser.std.StdSerializer.acceptJsonFormatVisitor.

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

Annotations
@Override
formatback to summary
private String format(final MonetaryAmount value, final SerializationContext ctxt)
isUnwrappingSerializerback to summary
public boolean isUnwrappingSerializer()

Overrides tools.jackson.databind.ValueSerializer.isUnwrappingSerializer.

Doc from tools.jackson.databind.ValueSerializer.isUnwrappingSerializer.

Accessor for checking whether this serializer is an "unwrapping" serializer; this is necessary to know since it may also require caller to suppress writing of the leading property name.

Annotations
@Override
serializeback to summary
public void serialize(final MonetaryAmount value, final JsonGenerator json, final SerializationContext ctxt)

Implements abstract tools.jackson.databind.ser.std.StdSerializer.serialize.

Doc from tools.jackson.databind.ValueSerializer.serialize.

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

Annotations
@Override
serializeWithTypeback to summary
public void serializeWithType(final MonetaryAmount value, final JsonGenerator generator, final SerializationContext provider, final TypeSerializer serializer)

Overrides tools.jackson.databind.ValueSerializer.serializeWithType.

Doc from tools.jackson.databind.ValueSerializer.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.
Annotations
@Override
transformNameback to summary
private String transformName(String name)
unwrappingSerializerback to summary
public ValueSerializer<MonetaryAmount> unwrappingSerializer(final NameTransformer nameTransformer)

Overrides tools.jackson.databind.ValueSerializer.unwrappingSerializer.

Doc from tools.jackson.databind.ValueSerializer.unwrappingSerializer.

Method that will return serializer instance that produces "unwrapped" serialization, if applicable for type being serialized (which is the case for some serializers that produce JSON Objects as output). If no unwrapped serializer can be constructed, will simply return serializer as-is.

Default implementation just returns serializer as-is, indicating that no unwrapped variant exists

Annotations
@Override