Class EnumFlag<T extends Enum<T>>

java.lang.Object
com.sk89q.worldguard.protection.flags.Flag<T>
com.sk89q.worldguard.protection.flags.EnumFlag<T>
Direct Known Subclasses:
RegionGroupFlag

public class EnumFlag<T extends Enum<T>> extends Flag<T>
Stores an enum value.
  • Constructor Details

  • Method Details

    • getEnumClass

      public Class<T> getEnumClass()
      Get the enum class.
      Returns:
      the enum class
    • detectValue

      public T detectValue(String input)
      Fuzzy detect the value if the value is not found.
      Parameters:
      input - string input
      Returns:
      value or null
    • parseInput

      public T parseInput(FlagContext context) throws InvalidFlagFormat
      Description copied from class: Flag
      Parse a given input to coerce it to a type compatible with the flag.
      Specified by:
      parseInput in class Flag<T extends Enum<T>>
      Parameters:
      context - the FlagContext
      Returns:
      The coerced type
      Throws:
      InvalidFlagFormat - Raised if the input is invalid
    • unmarshal

      public T unmarshal(Object o)
      Description copied from class: Flag
      Convert a raw type that was loaded (from a YAML file, for example) into the type that this flag uses.
      Specified by:
      unmarshal in class Flag<T extends Enum<T>>
      Parameters:
      o - The object
      Returns:
      The unmarshalled type
    • marshal

      public Object marshal(T o)
      Description copied from class: Flag
      Convert the value stored for this flag into a type that can be serialized into YAML.
      Specified by:
      marshal in class Flag<T extends Enum<T>>
      Parameters:
      o - The object
      Returns:
      The marshalled type