Module watamebot
Package net.foxgenesis.property
Interface IPropertyField<K,F,M extends IPropertyMapping>
- Type Parameters:
K- Key type that points to a propertyF- Lookup data type that coincides property lookupM- Property mapping type that turns the raw property data into a usable type
- All Known Implementing Classes:
GuildProperty
public interface IPropertyField<K,F,M extends IPropertyMapping>
An interface that provides generic methods used to retrieve and set
properties from various data structures.
- Author:
- Ashley
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionGet this property's data wrapped in anIPropertyMapping.default <U> UGet this property's value by applying the mapping into theresolverfunction.default <U> UGet this property's value by applying the mapping into theresolverfunction or returning the fallback suppliers value if theresolver's result isnull.default <U> UGet this property's value by applying the mapping into theresolverfunction or returning the fallback value if theresolver's result isnull.getKey()Get the key pointing to the property.booleanCheck if this property is end user editable.booleanCheck if this property is present.booleanUpdate/Set this property's value.default booleanUpdate/Set this property's value.
-
Method Details
-
get
Get this property's data wrapped in anIPropertyMapping.- Parameters:
from- - property lookup data- Returns:
- The property's data inside an
IPropertyMapping
-
get
default <U> U get(@Nonnull F from, @Nonnull Supplier<U> fallback, @Nonnull Function<? super M, ? extends U> resolver) Get this property's value by applying the mapping into theresolverfunction or returning the fallback suppliers value if theresolver's result isnull.- Type Parameters:
U- - returned data type of theresolver- Parameters:
from- - property lookup datafallback- - supplier providing a fallback valueresolver- - function to resolve the mapping into a usable data type- Returns:
- Returns the property's value by applying it using the
resolverfunction. If the result of theresolverfunction isnull, thefallbacksupplier's value will be returned instead
-
get
default <U> U get(@Nonnull F from, @Nullable U fallback, @Nonnull Function<? super M, ? extends U> resolver) Get this property's value by applying the mapping into theresolverfunction or returning the fallback value if theresolver's result isnull.- Type Parameters:
U- - returned data type of theresolver- Parameters:
from- - property lookup datafallback- - fallback valueresolver- - function to resolve the mapping into a usable data type- Returns:
- Returns the property's value by applying it using the
resolverfunction. If the result of theresolverfunction isnull, thefallbackvalue will be returned instead
-
get
Get this property's value by applying the mapping into theresolverfunction.- Type Parameters:
U- - returned data type of theresolver- Parameters:
from- - property lookup dataresolver- - function to resolve the mapping into a usable data type- Returns:
- Returns the property's value by applying the mapping into the
resolverfunction.
-
set
Update/Set this property's value.- Parameters:
from- - property lookup datavalue- - the new value- Returns:
- Returns
trueif the property was updated successfully - See Also:
-
set
Update/Set this property's value.- Parameters:
from- - property lookup datavalue- - the new valueuserEdited- - was this change initiated by the end user- Returns:
- Returns
trueif the property was updated successfully - Throws:
UnmodifiablePropertyException- Thrown if this property is not editable anduserEditedistrue- See Also:
-
getKey
Get the key pointing to the property.- Returns:
- The property's key
-
isPresent
Check if this property is present.- Parameters:
from- - lookup data- Returns:
- Returns
trueif the property was found using the provided lookup data
-
isEditable
boolean isEditable()Check if this property is end user editable.- Returns:
- Returns
trueif this property is allowed to be modified by the end user
-