Class EnumCodec.Builder<T extends Enum<?>>

java.lang.Object
foundry.veil.api.util.EnumCodec.Builder<T>
Type Parameters:
T - The enum type to encode/decode
Enclosing class:
EnumCodec<T extends Enum<?>>

public static class EnumCodec.Builder<T extends Enum<?>> extends Object
Builder for creating a new EnumCodec.
  • Constructor Details

    • Builder

      public Builder(String name)
  • Method Details

    • values

      public EnumCodec.Builder<T> values(Class<T> clazz)
      Sets the valid values of this codec to all the enum constants provided by the specified class.
      Parameters:
      clazz - The class to get the constants of
    • values

      @SafeVarargs public final EnumCodec.Builder<T> values(T... values)
      Sets the valid values of this codec to the specified values.
      Parameters:
      values - The values to use
    • toStringFunction

      public EnumCodec.Builder<T> toStringFunction(Function<T,String> toString)
      Specifies what function to use when getting the name of an enum constant.
      Parameters:
      toString - The new function
    • uppercase

      public EnumCodec.Builder<T> uppercase()
      Specifies the standard names to be uppercase.
    • lowercase

      public EnumCodec.Builder<T> lowercase()
      Specifies the standard names to be lowercase.
    • build

      public EnumCodec<T> build()
      Returns:
      A new enum codec