Package dev.drtheo.autojson.schema.base
Interface ObjectSchema
-
- All Implemented Interfaces:
-
dev.drtheo.autojson.schema.base.Schema
public interface ObjectSchema<T> implements Schema<T>
One of the base implementations of the Schema class. Used for serializing into an object format (key-value pairs).
-
-
Method Summary
Modifier and Type Method Description abstract <To> voidserialize(JsonAdapter<Object, To> adapter, JsonSerializationContext.Obj ctx, T t)abstract Tinstantiate()bytetype()The type of the schema. <To> JsonSerializationContext.Builtserialize(JsonAdapter<Object, To> adapter, JsonSerializationContext ctx, T t)abstract <To> voiddeserialize(JsonAdapter<Object, To> adapter, JsonDeserializationContext ctx, T t, String field)-
-
Method Detail
-
serialize
abstract <To> void serialize(JsonAdapter<Object, To> adapter, JsonSerializationContext.Obj ctx, T t)
- Parameters:
adapter- the adapter used to serialize this object.ctx- the serialization context.t- the object you're serializing.
-
instantiate
abstract T instantiate()
- Returns:
A new instance of the object this schema serializes.
-
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> void deserialize(JsonAdapter<Object, To> adapter, JsonDeserializationContext ctx, T t, String field)
- Parameters:
adapter- the adapter used to deserialize this object.ctx- the deserialization context.t- the object you're deserializing the data into.field- the name of the field you're deserializing.
-
-
-
-