| Constructor and Description |
|---|
OptionalProperty(Property<T> baseProperty) |
OptionalProperty(Property<T> baseProperty,
T defaultValue) |
| Modifier and Type | Method and Description |
|---|---|
PropertyValue<Optional<T>> |
determineValue(PropertyReader reader)
Returns the value, based on the given reader, which should be used for this property.
|
Optional<T> |
getDefaultValue()
Returns the default value of this property.
|
String |
getPath() |
boolean |
isValidValue(Optional<T> value)
Returns whether the value can be associated to the given property, i.e.
|
Object |
toExportValue(Optional<T> value)
Converts the given value to a representation that is suitable for exporting by a property resource.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitisValidInResourcepublic String getPath()
public PropertyValue<Optional<T>> determineValue(PropertyReader reader)
PropertyBaseProperty never return null. The return value must be in sync with
Property.isValidValue(Object).determineValue in interface Property<Optional<T>>reader - the reader to construct the value from (if possible)public Optional<T> getDefaultValue()
PropertygetDefaultValue in interface Property<Optional<T>>public boolean isValidValue(Optional<T> value)
Property
This method is used in ConfigurationDataImpl.setValue(ch.jalu.configme.properties.Property<T>, T), which
throws an exception if this method returns false. Therefore, this method is intended as a last catch
for invalid values and to ensure that programmatically no invalid value can be set. Extended validation of
values encountered in the property reader should be preferably handled in Property.determineValue(ch.jalu.configme.resource.PropertyReader),
or in an extension of MigrationService.
isValidValue in interface Property<Optional<T>>value - the value to checkpublic Object toExportValue(Optional<T> value)
Property
The values which are suitable for returning depend on the support of the used property resource. By default,
the supported types include null, String, Integer, Double, Boolean; Collection of the aforementioned
types; Map with String keys and values of any of the aforementioned types. Maps and collections can be nested at
any arbitrary level. Null signifies that the property/value should be skipped in the export.
toExportValue in interface Property<Optional<T>>value - the value to convert to an export valueCopyright © 2016–2021 The AuthMe Team. All rights reserved.