public interface Configuration
Modifier and Type | Method and Description |
---|---|
default java.lang.Object |
get(java.lang.String name)
Get a property's object from this configuration if it exists.
|
ConfigurationArray |
getArray(java.lang.String name)
Get an ConfigurationArray from this configuration if it exists.
|
boolean |
getBoolean(java.lang.String name)
Get a boolean property from this configuration if it exists.
|
Configuration |
getInner(java.lang.String name)
Get an inner Configuration object from this configuration if it exists.
|
java.lang.Number |
getNumber(java.lang.String name)
Get a number property from this configuration if it exists.
|
java.util.Collection<java.lang.String> |
getProperties()
Returns a collection of the property names available in this configuration.
|
default java.util.Map<java.lang.String,java.lang.Object> |
getRawData()
Gets a copy of the raw data of this configuration.
|
java.lang.String |
getString(java.lang.String name)
Get a String property from this configuration if it exists.
|
default boolean |
hasArray(java.lang.String name)
Returns whether this configuration has an Object[] property of the given name.
|
default boolean |
hasBoolean(java.lang.String name)
Returns whether this configuration has a boolean property of the given name.
|
default boolean |
hasInner(java.lang.String name)
Returns whether this configuration has a Configuration property of the given name.
|
default boolean |
hasNumber(java.lang.String name)
Returns whether this configuration has a number property of the given name.
|
default boolean |
hasString(java.lang.String name)
Returns whether this configuration has a String property of the given name.
|
default java.util.Optional<java.lang.Object> |
tryGet(java.lang.String name)
Tries to get an Object from this configuration.
|
default java.util.Optional<ConfigurationArray> |
tryGetArray(java.lang.String name)
Tries to get an ConfigurationArray property from this configuration.
|
default java.util.Optional<java.lang.Boolean> |
tryGetBoolean(java.lang.String name)
Tries to get a boolean property from this configuration.
|
default java.util.Optional<Configuration> |
tryGetInner(java.lang.String name)
Tries to get a Configuration property from this configuration.
|
default java.util.Optional<java.lang.Number> |
tryGetNumber(java.lang.String name)
Tries to get a number property from this configuration.
|
default java.util.Optional<java.lang.String> |
tryGetString(java.lang.String name)
Tries to get a String property from this configuration.
|
java.lang.Number getNumber(java.lang.String name) throws NoSuchPropertyException
tryGetNumber(String)
.name
- The name of the propertyNoSuchPropertyException
- If there is no property with the given name, or if there is a property with the
given name, but of a different type.default java.util.Optional<java.lang.Number> tryGetNumber(java.lang.String name)
name
- The name of the propertydefault boolean hasNumber(java.lang.String name)
getNumber(String)
is guaranteed not to throw an exception, and tryGetNumber(String)
is guaranteed to contain an object and not be empty.name
- The name of the property.boolean getBoolean(java.lang.String name) throws NoSuchPropertyException
tryGetBoolean(String)
.name
- The name of the propertyNoSuchPropertyException
- If there is no property with the given name, or if there is a property with the
given name, but of a different type.default java.util.Optional<java.lang.Boolean> tryGetBoolean(java.lang.String name)
name
- The name of the propertydefault boolean hasBoolean(java.lang.String name)
getBoolean(String)
is guaranteed not to throw an exception, and tryGetBoolean(String)
is guaranteed to contain an object and not be empty.name
- The name of the property.java.lang.String getString(java.lang.String name) throws NoSuchPropertyException
tryGetString(String)
.name
- The name of the propertyNoSuchPropertyException
- If there is no property with the given name, or if there is a property with the
given name, but of a different type.default java.util.Optional<java.lang.String> tryGetString(java.lang.String name)
name
- The name of the propertydefault boolean hasString(java.lang.String name)
getString(String)
is guaranteed not to throw an exception, and tryGetString(String)
is guaranteed to contain an object and not be empty.name
- The name of the property.ConfigurationArray getArray(java.lang.String name) throws NoSuchPropertyException
tryGetArray(String)
. The returned array may be empty.name
- The name of the propertyNoSuchPropertyException
- If there is no property with the given name, or if there is a property with the
given name, but of a different type.default java.util.Optional<ConfigurationArray> tryGetArray(java.lang.String name)
name
- The name of the propertydefault boolean hasArray(java.lang.String name)
getArray(String)
is guaranteed not to throw an exception. However, it still may return an empty
array.name
- The name of the property.Configuration getInner(java.lang.String name) throws NoSuchPropertyException
tryGetInner(String)
.name
- The name of the propertyNoSuchPropertyException
- If there is no property with the given name, or if there is a property with the
given name, but of a different type.default java.util.Optional<Configuration> tryGetInner(java.lang.String name)
name
- The name of the propertydefault boolean hasInner(java.lang.String name)
getInner(String)
is guaranteed not to throw an exception, and tryGetInner(String)
is guaranteed to contain an object and not be empty.name
- The name of the property.default java.lang.Object get(java.lang.String name) throws NoSuchPropertyException
tryGet(String)
. The object will be of any of the different types which can be stored
in this configuration object.name
- The name of the property.NoSuchPropertyException
- If there is no property with the given namedefault java.util.Optional<java.lang.Object> tryGet(java.lang.String name)
name
- The name of the propertyjava.util.Collection<java.lang.String> getProperties()
get(String)
and not to return an empty optional
on tryGet(String)
.default java.util.Map<java.lang.String,java.lang.Object> getRawData()