Interface WrapperSchema<T,B>

Type Parameters:
T - the type this schema serializes.
All Superinterfaces:
Schema<T>

public non-sealed interface WrapperSchema<T,B> extends Schema<T>
One of the base implementations of the Schema class. A schema used to serialize a class that wraps another object with its own schema.
  • Method Details

    • asObject

      default <S> ObjectSchema<S> asObject()
      Specified by:
      asObject in interface Schema<T>
    • asArray

      default <S> ArraySchema<S,?> asArray()
      Specified by:
      asArray in interface Schema<T>
    • asPrimitive

      default <S> PrimitiveSchema<S> asPrimitive()
      Specified by:
      asPrimitive in interface Schema<T>
    • type

      default byte type()
      Description copied from interface: Schema
      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.
      Specified by:
      type in interface Schema<T>
      Returns:
      the type of this schema.
    • wrapping

      Type wrapping()
      Returns:
      the type you're wrapping (same as WrapperSchema).
    • deserialize

      <To> T deserialize(JsonAdapter<Object,To> adapter, B t)
      Type Parameters:
      To - the type the adapter serializes to.
      Parameters:
      adapter - the adapter used to deserialize this object.
      t - the object you're deserializing the data into.
      Returns:
      The deserialized wrapped object.
    • child

      Schema<B> child()
      Returns:
      the child schema this wrapper schema wraps around.