Class ConfigurableFactoryContext
java.lang.Object
games.stendhal.server.core.config.factory.ConfigurableFactoryContext
A configuration context for general object factories.
-
Constructor Summary
ConstructorDescriptionConfigurableFactoryContext(Map<String,String> attributes)
Create a configuration context using an attribute map. -
Method Summary
Modifier and TypeMethodDescriptionboolean
getBoolean(String name, boolean defaultValue)
gets an attribute.int
gets an attribute.boolean
getRequiredBoolean(String name)
gets an attribute.int
getRequiredInt(String name)
gets an attribute.getRequiredString(String name)
gets an attribute.gets an attribute.
-
Constructor Details
-
ConfigurableFactoryContext
Create a configuration context using an attribute map. NOTE: The attributes are not copied.- Parameters:
attributes
- The attributes.
-
-
Method Details
-
getBoolean
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
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
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
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
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
gets an attribute.- Parameters:
name
- the attribute name.- Returns:
- the value of the attribute
- Throws:
IllegalArgumentException
- in case is missing
-