Class ConfigurableFactoryContext

java.lang.Object
games.stendhal.server.core.config.factory.ConfigurableFactoryContext

public class ConfigurableFactoryContext extends Object
A configuration context for general object factories.
  • Constructor Details

    • ConfigurableFactoryContext

      public ConfigurableFactoryContext(Map<String,​String> attributes)
      Create a configuration context using an attribute map. NOTE: The attributes are not copied.
      Parameters:
      attributes - The attributes.
  • Method Details

    • getBoolean

      public boolean getBoolean(String name, boolean defaultValue)
      gets an attribute.
      Parameters:
      name - the attribute name.
      defaultValue - the default value it case it is not defined
      Returns:
      the value of the attribute
      Throws:
      IllegalArgumentException - in case the value is not a valid boolean
    • getRequiredBoolean

      public boolean getRequiredBoolean(String name)
      gets an attribute.
      Parameters:
      name - the attribute name.
      Returns:
      the value of the attribute
      Throws:
      IllegalArgumentException - in case the value is not a valid boolean or is missing
    • getInt

      public int getInt(String name, int defaultValue)
      gets an attribute.
      Parameters:
      name - the attribute name.
      defaultValue - the default value it case it is not defined
      Returns:
      the value of the attribute
      Throws:
      IllegalArgumentException - in case the value is not a valid integer
    • getRequiredInt

      public int getRequiredInt(String name)
      gets an attribute.
      Parameters:
      name - the attribute name.
      Returns:
      the value of the attribute
      Throws:
      IllegalArgumentException - in case the value is not a valid integer or is missing
    • getString

      public String getString(String name, String defaultValue)
      gets an attribute.
      Parameters:
      name - the attribute name.
      defaultValue - the default value it case it is not defined
      Returns:
      the value of the attribute
    • getRequiredString

      public String getRequiredString(String name)
      gets an attribute.
      Parameters:
      name - the attribute name.
      Returns:
      the value of the attribute
      Throws:
      IllegalArgumentException - in case is missing