Class JavaEnumSchema<T extends Enum<T>>

java.lang.Object
dev.drtheo.autojson.schema.template.JavaEnumSchema<T>
All Implemented Interfaces:
PrimitiveSchema<T>, Schema<T>

public class JavaEnumSchema<T extends Enum<T>> extends Object implements PrimitiveSchema<T>
  • Constructor Details

    • JavaEnumSchema

      public JavaEnumSchema(Class<T> enumClass)
  • Method Details

    • unwrap

      public static <T, E extends Enum<E>> JavaEnumSchema<E> unwrap(Class<T> clazz)
    • serialize

      public <To> void serialize(JsonAdapter<Object,To> auto, JsonSerializationContext.Primitive c, T anEnum)
      Specified by:
      serialize in interface PrimitiveSchema<T extends Enum<T>>
      Type Parameters:
      To - the type the adapter serializes to.
      Parameters:
      auto - the adapter used to serialize this object.
      c - the serialization context. Used to provide the value.
      anEnum - the object you're serializing.
    • deserialize

      public <To> T deserialize(JsonAdapter<Object,To> auto, JsonDeserializationContext c)
      Specified by:
      deserialize in interface PrimitiveSchema<T extends Enum<T>>
      Type Parameters:
      To - whatever the adapter's serializing to.
      Parameters:
      auto - the adapter used to deserialize this object.
      c - the deserialization context. Used to query the deserialization.
      Returns:
      The deserialized object.