Package dev.drtheo.autojson.schema.base
Interface ArraySchema
-
- All Implemented Interfaces:
-
dev.drtheo.autojson.schema.base.Schema
public interface ArraySchema<T, Intermediary> implements Schema<T>
One of the base implementations of the Schema class. Used for serializing into an array format (indexed values).
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfaceArraySchema.SimpleA utility class that implements ArraySchema without an intermediary value.
-
Method Summary
Modifier and Type Method Description abstract <To> voidserialize(JsonAdapter<Object, To> adapter, JsonSerializationContext.Array ctx, T t)abstract Intermediaryinstantiate()abstract Tpack(Intermediary obj)Converts the Intermediary type into the built T type. bytetype()The type of the schema. <To> JsonSerializationContext.Builtserialize(JsonAdapter<Object, To> adapter, JsonSerializationContext ctx, T t)abstract <To> Intermediarydeserialize(JsonAdapter<Object, To> adapter, JsonDeserializationContext ctx, Intermediary o, int index)-
-
Method Detail
-
serialize
abstract <To> void serialize(JsonAdapter<Object, To> adapter, JsonSerializationContext.Array ctx, T t)
- Parameters:
adapter- the adapter used to serialize this object.ctx- the serialization context.t- the object you're serializing.
-
instantiate
abstract Intermediary instantiate()
- Returns:
a new instance of the Intermediary type.
-
pack
abstract T pack(Intermediary obj)
Converts the Intermediary type into the built T type.
- Parameters:
obj- the Intermediary object.- Returns:
the built T object.
-
type
byte type()
The type of the schema. Instead of doing if-instanceof checks for the schema implementations, the adapters should use the SchemaType with a switch statement instead.
- Returns:
the type of this schema.
-
serialize
<To> JsonSerializationContext.Built serialize(JsonAdapter<Object, To> adapter, JsonSerializationContext ctx, T t)
-
deserialize
abstract <To> Intermediary deserialize(JsonAdapter<Object, To> adapter, JsonDeserializationContext ctx, Intermediary o, int index)
- Parameters:
adapter- the adapter used to deserialize this object.ctx- the deserialization context.o- the object you're deserializing the data into.index- the index of the element, maintaining the order used for serialization in serialize.- Returns:
the new Intermediary value.
-
-
-
-