Module watamebot
Package net.foxgenesis.property
Interface ImmutableProperty<L,M extends PropertyMapping>
- All Known Subinterfaces:
ImmutableLCKProperty,ImmutablePluginProperty,LCKProperty,PluginProperty,Property<L,M>
public interface ImmutableProperty<L,M extends PropertyMapping>
-
Method Summary
Modifier and TypeMethodDescriptionGet the current value of this property.default <U> UGet the current value of this property and map it with the specifiedmapper.default <U> UGet the current value of this property and map it with the specifiedmapper.@NotNull PropertyInfogetInfo()Get the definition of this propertygetOr(L lookup, @NotNull ImmutableProperty<L, M> fallback) Get the current value of this property if present.booleanCheck if this property is populated in the configuration.
-
Method Details
-
get
Get the current value of this property.- Parameters:
lookup- - property lookup- Returns:
- Returns an
OptionalPropertyMappingcontaining the raw data retrieved
-
getOr
@NotNull default @NotNull Optional<M> getOr(@NotNull L lookup, @NotNull @NotNull ImmutableProperty<L, M> fallback) Get the current value of this property if present. Otherwise get the current value of the specifiedfallback.- Parameters:
lookup- - property lookupfallback- - fallback property- Returns:
- Returns a
OptionalPropertyMappingcontaining the raw data retrieved
-
get
Get the current value of this property and map it with the specifiedmapper.This method is effectively equivalent to:
get(lookup, null, mapper)
- Type Parameters:
U- Return type- Parameters:
lookup- - property lookupmapper- - function to convert the raw data into a usable type- Returns:
- Returns the mapped data or
nullif this property is empty
-
get
@Nullable default <U> U get(@NotNull L lookup, @Nullable @Nullable Supplier<U> defaultValue, @NotNull @NotNull Function<? super M, U> mapper) Get the current value of this property and map it with the specifiedmapper. If the property is empty, thedefaultValuewill be returned instead.This method is effectively equivalent to:
get(lookup).map(mapper).orElseGet(defaultValue != null ? defaultValue : () -> null);
- Type Parameters:
U- Return type- Parameters:
lookup- - property lookupdefaultValue- - default value suppliermapper- - function to convert the raw data into a usable type- Returns:
- Returns the mapped data or
defaultValueif this property is empty
-
isPresent
Check if this property is populated in the configuration.- Parameters:
lookup- - property lookup- Returns:
- Returns
trueif thelookupwith thisPropertyInfowas found inside the configuration (empty or not)
-
getInfo
Get the definition of this property- Returns:
- Returns the
PropertyInfolinked to this property
-