Interface ConfigurationProperty
A configuration property.
A configuration property is identified by a configuration key which is composed of a name and a collection of parameters defining the context for which a property value is defined. This means that for a given property name, multiple values can be defined in a configuration source for different contexts.
- Author:
- Jeremy Kuhn
- See Also:
-
Method Summary
Modifier and TypeMethodDescription<T> Optional
<T> Converts the property value to the specified type.<T> T
Returns the converted value or the specified default value.<T> Optional
<T> Converts the property value to the specified type.<T> T
Returns the converted value or the specified default value.<T> Optional
<T[]> Converts the property value to an array of the specified type.<T> T[]
Returns the converted value or the specified default array.<T> Optional
<T[]> Converts the property value to an array of the specified type.<T> T[]
Returns the converted value or the specified default array.Converts the property value to a big decimal.asBigDecimal
(BigDecimal defaultValue) Returns the converted value or the specified default value.Converts the property value to a big integer.asBigInteger
(BigInteger defaultValue) Returns the converted value or the specified default value.Converts the property value to a boolean.boolean
asBoolean
(boolean defaultValue) Returns the converted value or the specified default value.asByte()
Converts the property value to a byte.byte
asByte
(byte defaultValue) Returns the converted value or the specified default value.Converts the property value to a character.char
asCharacter
(char defaultValue) Returns the converted value or the specified default value.asClass()
Converts the property value to a class.<T> Class
<T> Returns the converted value or the specified default value.Converts the property value to a currency.asCurrency
(Currency defaultValue) Returns the converted value or the specified default value.asDouble()
Converts the property value to a double.double
asDouble
(double defaultValue) Returns the converted value or the specified default value.asFile()
Converts the property value to a file.Returns the converted value or the specified default value.asFloat()
Converts the property value to a float.float
asFloat
(float defaultValue) Returns the converted value or the specified default value.Converts the property value to an inet address.asInetAddress
(InetAddress defaultValue) Returns the converted value or the specified default value.Converts the property value to an inet socket address.asInetSocketAddress
(InetSocketAddress defaultValue) Returns the converted value or the specified default value.Converts the property value to an integer.int
asInteger
(int defaultValue) Returns the converted value or the specified default value.Converts the property value to a list of the specified type.<T> List
<T> Returns the converted value or the specified default list.Converts the property value to a list of the specified type.<T> List
<T> Returns the converted value or the specified default list.Converts the property value to a local date.asLocalDate
(LocalDate defaultValue) Returns the converted value or the specified default value.Converts the property value to a local date time.asLocalDateTime
(LocalDateTime defaultValue) Returns the converted value or the specified default value.asLocale()
Converts the property value to a locale.Returns the converted value or the specified default value.asLong()
Converts the property value to a long.long
asLong
(long defaultValue) Returns the converted value or the specified default value.asPath()
Converts the property value to a path.Returns the converted value or the specified default value.Converts the property value to a pattern.Returns the converted value or the specified default value.Converts the property value to a set of the specified type.<T> Set
<T> Returns the converted value or the specified default set.Converts the property value to a set of the specified type.<T> Set
<T> Returns the converted value or the specified default set.asShort()
Converts the property value to a short.short
asShort
(short defaultValue) Returns the converted value or the specified default value.asString()
Converts the property value to a string.Returns the converted value or the specified default value.asURI()
Converts the property value to a URI.Returns the converted value or the specified default value.asURL()
Converts the property value to a URL.Returns the converted value or the specified default value.Converts the property value to a zoned date time.asZonedDateTime
(ZonedDateTime defaultValue) Returns the converted value or the specified default value.getKey()
Returns the key identifying the property and the context in which it has been defined.Returns the configuration source that loaded the property.boolean
isEmpty()
Determines whether the value is empty (ie. value is null).boolean
Determines whether the value is present (ie. value is not null).boolean
isUnset()
Determines whether this property is unset.
-
Method Details
-
getKey
ConfigurationKey getKey()Returns the key identifying the property and the context in which it has been defined.
- Returns:
- a configuration key
-
getSource
ConfigurationSource getSource()Returns the configuration source that loaded the property.
- Returns:
- a configuration source.
-
isUnset
boolean isUnset()Determines whether this property is unset.
Unset properties are always empty, they are used in a
CompositeConfigurationSource
to cancel non-empty properties retrieved from sources with lower priority.- Returns:
- true if the property is unset, false otherwise
-
isPresent
boolean isPresent()Determines whether the value is present (ie. value is not null).
- Returns:
- true if the property value is not null, false otherwise
-
isEmpty
boolean isEmpty()Determines whether the value is empty (ie. value is null).
- Returns:
- true if the property value is null, false otherwise
-
as
Converts the property value to the specified type.
- Type Parameters:
T
- the target type- Parameters:
type
- a class of type T- Returns:
- an optional returning the converted value or an empty optional if the property is empty
-
as
Returns the converted value or the specified default value.
- Type Parameters:
T
- the target type- Parameters:
type
- a class of type TdefaultValue
- a default value- Returns:
- the converted value or the default value
-
as
Converts the property value to the specified type.
- Type Parameters:
T
- the target type- Parameters:
type
- the target type- Returns:
- an optional returning the converted value or an empty optional if the property is empty
-
as
Returns the converted value or the specified default value.
- Type Parameters:
T
- the target type- Parameters:
type
- a class of type TdefaultValue
- a default value- Returns:
- the converted value or the default value
-
asArrayOf
Converts the property value to an array of the specified type.
- Type Parameters:
T
- the target component type- Parameters:
type
- a class of type T- Returns:
- an optional returning the converted value or an empty optional if the property is empty
-
asArrayOf
Returns the converted value or the specified default array.
- Type Parameters:
T
- the target component type- Parameters:
type
- the target component typedefaultValue
- a default array- Returns:
- the converted value or the default array
-
asArrayOf
Converts the property value to an array of the specified type.
- Type Parameters:
T
- the target component type- Parameters:
type
- the target component type- Returns:
- an optional returning the converted value or an empty optional if the property is empty
-
asArrayOf
Returns the converted value or the specified default array.
- Type Parameters:
T
- the target component type- Parameters:
type
- the target component typedefaultValue
- a default array- Returns:
- the converted value or the default array
-
asListOf
Converts the property value to a list of the specified type.
- Type Parameters:
T
- the target list argument type- Parameters:
type
- a class of type T- Returns:
- an optional returning the converted value or an empty optional if the property is empty
-
asListOf
Returns the converted value or the specified default list.
- Type Parameters:
T
- the target list argument type- Parameters:
type
- the target list argument typedefaultValue
- a default list- Returns:
- the converted value or the default list
-
asListOf
Converts the property value to a list of the specified type.
- Type Parameters:
T
- the target list argument type- Parameters:
type
- the target list argument type- Returns:
- an optional returning the converted value or an empty optional if the property is empty
-
asListOf
Returns the converted value or the specified default list.
- Type Parameters:
T
- the target list argument type- Parameters:
type
- the target list argument typedefaultValue
- a default list- Returns:
- the converted value or the default list
-
asSetOf
Converts the property value to a set of the specified type.
- Type Parameters:
T
- the target set argument type- Parameters:
type
- a class of type T- Returns:
- an optional returning the converted value or an empty optional if the property is empty
-
asSetOf
Returns the converted value or the specified default set.
- Type Parameters:
T
- the target set argument type- Parameters:
type
- the target set argument typedefaultValue
- a default set- Returns:
- the converted value or the default set
-
asSetOf
Converts the property value to a set of the specified type.
- Type Parameters:
T
- the target set argument type- Parameters:
type
- the target set argument type- Returns:
- an optional returning the converted value or an empty optional if the property is empty
-
asSetOf
Returns the converted value or the specified default set.
- Type Parameters:
T
- the target set argument type- Parameters:
type
- the target set argument typedefaultValue
- a default set- Returns:
- the converted value or the default set
-
asByte
Converts the property value to a byte.
- Returns:
- an optional returning the converted value or an empty optional if the property is empty
-
asByte
byte asByte(byte defaultValue) Returns the converted value or the specified default value.
- Parameters:
defaultValue
- a default value- Returns:
- the converted value or the default value
-
asShort
Converts the property value to a short.
- Returns:
- an optional returning the converted value or an empty optional if the property is empty
-
asShort
short asShort(short defaultValue) Returns the converted value or the specified default value.
- Parameters:
defaultValue
- a default value- Returns:
- the converted value or the default value
-
asInteger
Converts the property value to an integer.
- Returns:
- an optional returning the converted value or an empty optional if the property is empty
-
asInteger
int asInteger(int defaultValue) Returns the converted value or the specified default value.
- Parameters:
defaultValue
- a default value- Returns:
- the converted value or the default value
-
asLong
Converts the property value to a long.
- Returns:
- an optional returning the converted value or an empty optional if the property is empty
-
asLong
long asLong(long defaultValue) Returns the converted value or the specified default value.
- Parameters:
defaultValue
- a default value- Returns:
- the converted value or the default value
-
asFloat
Converts the property value to a float.
- Returns:
- an optional returning the converted value or an empty optional if the property is empty
-
asFloat
float asFloat(float defaultValue) Returns the converted value or the specified default value.
- Parameters:
defaultValue
- a default value- Returns:
- the converted value or the default value
-
asDouble
Converts the property value to a double.
- Returns:
- an optional returning the converted value or an empty optional if the property is empty
-
asDouble
double asDouble(double defaultValue) Returns the converted value or the specified default value.
- Parameters:
defaultValue
- a default value- Returns:
- the converted value or the default value
-
asCharacter
Converts the property value to a character.
- Returns:
- an optional returning the converted value or an empty optional if the property is empty
-
asCharacter
char asCharacter(char defaultValue) Returns the converted value or the specified default value.
- Parameters:
defaultValue
- a default value- Returns:
- the converted value or the default value
-
asString
Converts the property value to a string.
- Returns:
- an optional returning the converted value or an empty optional if the property is empty
-
asString
Returns the converted value or the specified default value.
- Parameters:
defaultValue
- a default value- Returns:
- the converted value or the default value
-
asBoolean
Converts the property value to a boolean.
- Returns:
- an optional returning the converted value or an empty optional if the property is empty
-
asBoolean
boolean asBoolean(boolean defaultValue) Returns the converted value or the specified default value.
- Parameters:
defaultValue
- a default value- Returns:
- the converted value or the default value
-
asBigInteger
Optional<BigInteger> asBigInteger()Converts the property value to a big integer.
- Returns:
- an optional returning the converted value or an empty optional if the property is empty
-
asBigInteger
Returns the converted value or the specified default value.
- Parameters:
defaultValue
- a default value- Returns:
- the converted value or the default value
-
asBigDecimal
Optional<BigDecimal> asBigDecimal()Converts the property value to a big decimal.
- Returns:
- an optional returning the converted value or an empty optional if the property is empty
-
asBigDecimal
Returns the converted value or the specified default value.
- Parameters:
defaultValue
- a default value- Returns:
- the converted value or the default value
-
asLocalDate
Converts the property value to a local date.
- Returns:
- an optional returning the converted value or an empty optional if the property is empty
-
asLocalDate
Returns the converted value or the specified default value.
- Parameters:
defaultValue
- a default value- Returns:
- the converted value or the default value
-
asLocalDateTime
Optional<LocalDateTime> asLocalDateTime()Converts the property value to a local date time.
- Returns:
- an optional returning the converted value or an empty optional if the property is empty
-
asLocalDateTime
Returns the converted value or the specified default value.
- Parameters:
defaultValue
- a default value- Returns:
- the converted value or the default value
-
asZonedDateTime
Optional<ZonedDateTime> asZonedDateTime()Converts the property value to a zoned date time.
- Returns:
- an optional returning the converted value or an empty optional if the property is empty
-
asZonedDateTime
Returns the converted value or the specified default value.
- Parameters:
defaultValue
- a default value- Returns:
- the converted value or the default value
-
asCurrency
Converts the property value to a currency.
- Returns:
- an optional returning the converted value or an empty optional if the property is empty
-
asCurrency
Returns the converted value or the specified default value.
- Parameters:
defaultValue
- a default value- Returns:
- the converted value or the default value
-
asLocale
Converts the property value to a locale.
- Returns:
- an optional returning the converted value or an empty optional if the property is empty
-
asLocale
Returns the converted value or the specified default value.
- Parameters:
defaultValue
- a default value- Returns:
- the converted value or the default value
-
asFile
Converts the property value to a file.
- Returns:
- an optional returning the converted value or an empty optional if the property is empty
-
asFile
Returns the converted value or the specified default value.
- Parameters:
defaultValue
- a default value- Returns:
- the converted value or the default value
-
asPath
Converts the property value to a path.
- Returns:
- an optional returning the converted value or an empty optional if the property is empty
-
asPath
Returns the converted value or the specified default value.
- Parameters:
defaultValue
- a default value- Returns:
- the converted value or the default value
-
asURI
Converts the property value to a URI.
- Returns:
- an optional returning the converted value or an empty optional if the property is empty
-
asURI
Returns the converted value or the specified default value.
- Parameters:
defaultValue
- a default value- Returns:
- the converted value or the default value
-
asURL
Converts the property value to a URL.
- Returns:
- an optional returning the converted value or an empty optional if the property is empty
-
asURL
Returns the converted value or the specified default value.
- Parameters:
defaultValue
- a default value- Returns:
- the converted value or the default value
-
asPattern
Converts the property value to a pattern.
- Returns:
- an optional returning the converted value or an empty optional if the property is empty
-
asPattern
Returns the converted value or the specified default value.
- Parameters:
defaultValue
- a default value- Returns:
- the converted value or the default value
-
asInetAddress
Optional<InetAddress> asInetAddress()Converts the property value to an inet address.
- Returns:
- an optional returning the converted value or an empty optional if the property is empty
-
asInetAddress
Returns the converted value or the specified default value.
- Parameters:
defaultValue
- a default value- Returns:
- the converted value or the default value
-
asInetSocketAddress
Optional<InetSocketAddress> asInetSocketAddress()Converts the property value to an inet socket address.
- Returns:
- an optional returning the converted value or an empty optional if the property is empty
-
asInetSocketAddress
Returns the converted value or the specified default value.
- Parameters:
defaultValue
- a default value- Returns:
- the converted value or the default value
-
asClass
Converts the property value to a class.
- Type Parameters:
T
- the target type- Returns:
- an optional returning the converted value or an empty optional if the property is empty
-
asClass
Returns the converted value or the specified default value.
- Parameters:
defaultValue
- a default value- Returns:
- the converted value or the default value
-