java.lang.Object
org.polyfrost.oneconfig.api.config.v1.serialize.adapter.Adapter<Color,int[]>
org.polyfrost.oneconfig.api.config.v1.serialize.adapter.impl.ColorAdapter

public class ColorAdapter extends Adapter<Color,int[]>
The only bundled adapter in the config system, which makes colors a lot more readable when serialized.
  • Constructor Details

    • ColorAdapter

      public ColorAdapter()
  • Method Details

    • deserialize

      public Color deserialize(int[] l)
      Description copied from class: Adapter
      Deserialize your object. The form will be identical to what you made in the Adapter.serialize(Object) method.
      Specified by:
      deserialize in class Adapter<Color,int[]>
      Parameters:
      l - the object (same as deserialize) to create your object from
      Returns:
      the complete object
    • serialize

      public int[] serialize(Color in)
      Description copied from class: Adapter
      Convert the given object into a serializable form.
      The following types can be returned by this method, and nothing more:
      • Primitive wrappers (any Number, Character, Boolean)
      • A String literal or any class implementing CharSequence
      • An Enum
      • An array of the above types, including primitives (e.g. byte[], int[]..)
      • A List of the above types
      • A Map<String, Object> of the above types, mapped to Strings, which are used as keys.
        Note that 'class' and 'value' are reserved keys and cannot be used.
      • Lists containing lists or maps containing maps (or lists) are also supported.
      Specified by:
      serialize in class Adapter<Color,int[]>
      Parameters:
      in - the object to serialize
    • getTargetClass

      public Class<Color> getTargetClass()
      Description copied from class: Adapter
      Due to Java type erasure, this method is used to get the type of the adapter.
      This is used internally to get what type adapter to use.
      Specified by:
      getTargetClass in class Adapter<Color,int[]>
    • getOutputClass

      public Class<int[]> getOutputClass()
      Description copied from class: Adapter
      Due to Java type erasure, this method is used to get the type of the adapter.
      This is used internally to get what type adapter to use.
      Specified by:
      getOutputClass in class Adapter<Color,int[]>