T - the property typepublic interface Property<T>
Property implementations should always extend from BaseProperty instead of implementing
this interface directly.
| Modifier and Type | Method and Description |
|---|---|
T |
determineValue(PropertyReader propertyReader)
Returns the value, based on the given reader, which should be used for this property.
|
T |
getDefaultValue()
Returns the default value of this property.
|
String |
getPath() |
boolean |
isPresent(PropertyReader propertyReader)
Returns true if a valid value for this property is present in the property reader, i.e.
|
boolean |
isValidValue(T value)
Returns whether the value can be associated to the given property, i.e.
|
Object |
toExportValue(T value)
Converts the given value to a representation that is suitable for exporting by a property resource.
|
String getPath()
T determineValue(PropertyReader propertyReader)
BaseProperty never return null. The return value must be in sync with
isValidValue(Object).propertyReader - the reader to construct the value from (if possible)T getDefaultValue()
boolean isPresent(PropertyReader propertyReader)
propertyReader - the reader to useboolean isValidValue(T value)
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 determineValue(ch.jalu.configme.resource.PropertyReader) or
in a MigrationService.
value - the value to check@Nullable Object toExportValue(T value)
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.
value - the value to convert to an export valueCopyright © 2016–2018 The AuthMe Team. All rights reserved.