Class StateConfig

java.lang.Object
com.blackrook.engine.state.StateConfig

public class StateConfig extends Object
A state configuration object. Holds parameters for a state transition and used on state entry.
Author:
Matthew Tropiano
  • Constructor Details

    • StateConfig

      protected StateConfig()
      Protected constructor for config.
  • Method Details

    • setParameter

      public void setParameter(String name, Object value)
      Sets a config parameter.
      Parameters:
      name - the parameter name.
      value - the parameter value.
    • getParameter

      public <T> T getParameter(Class<T> type, String name)
      Gets a config parameter, casting it to the desired type.
      Type Parameters:
      T - the type casted to.
      Parameters:
      type - the class type to cast to.
      name - the parameter name.
      Returns:
      the corresponding value, or null if not found.
      Throws:
      ClassCastException - if the value could not be casted to the desired type.
    • entry

      public static <T> Map.Entry<String,T> entry(String name, T value)
      Creates a single mapping entry.
      Type Parameters:
      T - the value type.
      Parameters:
      name - the parameter name.
      value - the parameter value.
      Returns:
      a new entry.
      See Also:
    • createConfig

      @SafeVarargs public static StateConfig createConfig(Map.Entry<String,Object>... entries)
      Creates a new state config using entries.
      Parameters:
      entries - the parameter mapping entries.
      Returns:
      a new state config.
      See Also: