Enum Class Environment

java.lang.Object
java.lang.Enum<Environment>
dev.jaxydog.astral.register.Environment
All Implemented Interfaces:
Serializable, Comparable<Environment>, Constable

@Internal public enum Environment extends Enum<Environment>
Represents a possible mod registration environment and its associated interface.

This is used to share common functionality during the automatic registration process.

You almost certainly do not need to use this directly.

Since:
2.0.0
See Also:
  • Enum Constant Details

    • COMMON

      public static final Environment COMMON
      Represents both the client and the server environments.

      Note that this is distinctly different from CLIENT and SERVER.

      The associated interface of this environment is Registered.Common.

      Since:
      2.0.0
    • CLIENT

      public static final Environment CLIENT
      Represents the game client environment.

      The associated interface of this environment is Registered.Client.

      Since:
      2.0.0
    • SERVER

      public static final Environment SERVER
      Represents the game server environment.

      The associated interface of this environment is Registered.Server.

      Since:
      2.0.0
    • GENERATOR

      public static final Environment GENERATOR
      Represents the data generation environment.

      The associated interface of this environment is Registered.Generated.

      Since:
      2.0.0
  • Method Details

    • values

      public static Environment[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static Environment valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • getInterface

      public final Class<? extends Registered> getInterface()
      Returns this environment's associated Registered interface.
      Returns:
      An extension of Registered.
      Since:
      2.0.0
    • registerValue

      public final void registerValue(Registered value) throws IllegalArgumentException
      Registers the provided value within this environment.

      This method blindly takes any instance of Registered and attempts to cast it into its associated type. Extra care should be taken to ensure that the value is of the proper interface.

      Parameters:
      value - The value to be registered.
      Throws:
      IllegalArgumentException - If the provided value is not a valid instance of the associated interface.
      Since:
      2.0.0
    • isIgnored

      public final boolean isIgnored(IgnoreRegistration annotation)
      Returns whether this environment should be skipped based off of the provided annotation.
      Parameters:
      annotation - The provided filter annotation.
      Returns:
      Whether this environment should be ignored.
      Since:
      2.0.0