Class ConfigurableFactoryContext
java.lang.Object
games.stendhal.server.core.config.factory.ConfigurableFactoryContext
A configuration context for general object factories.
-
Constructor Summary
ConstructorsConstructorDescriptionConfigurableFactoryContext(Map<String, String> attributes) Create a configuration context using an attribute map. -
Method Summary
Modifier and TypeMethodDescriptionbooleangetBoolean(String name, boolean defaultValue) gets an attribute.intgets an attribute.booleangetRequiredBoolean(String name) gets an attribute.intgetRequiredInt(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
-