T
- The generic property typepublic interface Property<T> extends NamedResource
Modifier and Type | Interface and Description |
---|---|
static class |
Property.BaseProperty<T> |
static class |
Property.BooleanProperty |
static class |
Property.CharsetProperty |
static class |
Property.DurationInSecondsProperty |
static class |
Property.DurationProperty |
static class |
Property.EnumProperty<T extends java.lang.Enum<T>> |
static class |
Property.IntegerProperty |
static class |
Property.LongProperty |
static class |
Property.ObjectProperty |
static class |
Property.StringProperty |
static class |
Property.Validating<T> |
BY_NAME_COMPARATOR, NAME_EXTRACTOR
Modifier and Type | Method and Description |
---|---|
static Property<java.lang.Boolean> |
bool(java.lang.String name) |
static Property<java.lang.Boolean> |
bool(java.lang.String name,
boolean def) |
static Property<java.nio.charset.Charset> |
charset(java.lang.String name) |
static Property<java.nio.charset.Charset> |
charset(java.lang.String name,
java.nio.charset.Charset def) |
static Property<java.time.Duration> |
duration(java.lang.String name) |
static Property<java.time.Duration> |
duration(java.lang.String name,
java.time.Duration def) |
static Property<java.time.Duration> |
durationSec(java.lang.String name) |
static Property<java.time.Duration> |
durationSec(java.lang.String name,
java.time.Duration def) |
static <T extends java.lang.Enum<T>> |
enum_(java.lang.String name,
java.lang.Class<T> type) |
static <T extends java.lang.Enum<T>> |
enum_(java.lang.String name,
java.lang.Class<T> type,
T def) |
java.util.Optional<T> |
get(PropertyResolver resolver) |
java.util.Optional<T> |
getDefault() |
T |
getOrCustomDefault(PropertyResolver resolver,
T defaultValue) |
default T |
getOrNull(PropertyResolver resolver) |
default T |
getRequired(PropertyResolver resolver) |
default T |
getRequiredDefault() |
java.lang.Class<T> |
getType() |
static Property<java.lang.Integer> |
integer(java.lang.String name) |
static Property<java.lang.Integer> |
integer(java.lang.String name,
int def) |
static Property<java.lang.Long> |
long_(java.lang.String name) |
static Property<java.lang.Long> |
long_(java.lang.String name,
long def) |
static Property<java.lang.Object> |
object(java.lang.String name) |
static Property<java.lang.Object> |
object(java.lang.String name,
java.lang.Object def) |
default void |
remove(PropertyResolver resolver) |
void |
set(PropertyResolver resolver,
T value) |
static Property<java.lang.String> |
string(java.lang.String name) |
static Property<java.lang.String> |
string(java.lang.String name,
java.lang.String def) |
static <T> Property<T> |
validating(Property<T> prop,
java.util.function.Consumer<? super T> validator) |
findByName, findFirstMatchByName, getName, getNameList, getNames, ofName, removeByName, safeCompareByName
static Property<java.lang.String> string(java.lang.String name)
static Property<java.lang.String> string(java.lang.String name, java.lang.String def)
static Property<java.lang.Boolean> bool(java.lang.String name)
static Property<java.lang.Boolean> bool(java.lang.String name, boolean def)
static Property<java.lang.Integer> integer(java.lang.String name)
static Property<java.lang.Integer> integer(java.lang.String name, int def)
static Property<java.lang.Long> long_(java.lang.String name)
static Property<java.lang.Long> long_(java.lang.String name, long def)
static <T extends java.lang.Enum<T>> Property<T> enum_(java.lang.String name, java.lang.Class<T> type)
static <T extends java.lang.Enum<T>> Property<T> enum_(java.lang.String name, java.lang.Class<T> type, T def)
static Property<java.time.Duration> duration(java.lang.String name)
static Property<java.time.Duration> duration(java.lang.String name, java.time.Duration def)
static Property<java.time.Duration> durationSec(java.lang.String name)
static Property<java.time.Duration> durationSec(java.lang.String name, java.time.Duration def)
static Property<java.nio.charset.Charset> charset(java.lang.String name)
static Property<java.nio.charset.Charset> charset(java.lang.String name, java.nio.charset.Charset def)
static Property<java.lang.Object> object(java.lang.String name)
static Property<java.lang.Object> object(java.lang.String name, java.lang.Object def)
static <T> Property<T> validating(Property<T> prop, java.util.function.Consumer<? super T> validator)
java.lang.Class<T> getType()
java.util.Optional<T> getDefault()
Optional
pre-defined default valuedefault T getRequiredDefault()
java.util.Optional<T> get(PropertyResolver resolver)
resolver
- The PropertyResolver
to query for the property value.Optional
result - if resolver contains a value then the resolver's value, otherwise
the pre-defined default
default T getRequired(PropertyResolver resolver)
resolver
- The PropertyResolver
to query for the property value.java.util.NoSuchElementException
- if resolver contains no value and no getDefault()
defineddefault T getOrNull(PropertyResolver resolver)
resolver
- The PropertyResolver
to query for the property value.null
if no specific value found in the resolver - regardless of
whether there is a default valueT getOrCustomDefault(PropertyResolver resolver, T defaultValue)
resolver
- The PropertyResolver
to query for the property value.defaultValue
- The default value to return if no specific value found in resolvervoid set(PropertyResolver resolver, T value)
resolver
- The PropertyResolver
to update with the property value.value
- The value to setdefault void remove(PropertyResolver resolver)
resolver
- The PropertyResolver
to remove the property from