public abstract class IntBasedTypeConverter<T> extends java.lang.Object implements TypeConverter<T>
| Constructor and Description |
|---|
IntBasedTypeConverter() |
| Modifier and Type | Method and Description |
|---|---|
abstract int |
convertToInt(T object)
Called to convert a an object of type T into an int.
|
abstract T |
getFromInt(int i)
Called to convert an int into an object of type T.
|
T |
parse(com.fasterxml.jackson.core.JsonParser jsonParser)
Called to parse the current object in the jsonParser to an object of type T
|
void |
serialize(T object,
java.lang.String fieldName,
boolean writeFieldNameForObject,
com.fasterxml.jackson.core.JsonGenerator jsonGenerator)
Called to serialize an object of type T to JSON using the JsonGenerator and field name.
|
public abstract T getFromInt(int i)
i - The int parsed from JSON.public abstract int convertToInt(T object)
object - The object being converted.public T parse(com.fasterxml.jackson.core.JsonParser jsonParser) throws java.io.IOException
TypeConverterparse in interface TypeConverter<T>jsonParser - The JsonParser that is pre-configured for this field.java.io.IOExceptionpublic void serialize(T object, java.lang.String fieldName, boolean writeFieldNameForObject, com.fasterxml.jackson.core.JsonGenerator jsonGenerator) throws java.io.IOException
TypeConverterserialize in interface TypeConverter<T>object - The object to serializefieldName - The JSON field name of the object when it is serializedwriteFieldNameForObject - If true, you're responsible for calling jsonGenerator.writeFieldName(fieldName) before writing the fieldjsonGenerator - The JsonGenerator object to which the object should be writtenjava.io.IOException