Module watamebot

Interface ImmutableProperty<K,F,M extends IPropertyMapping>

Type Parameters:
K - Key type that points to a property
F - Lookup data type that coincides property lookup
M - Property mapping type that turns the raw property data into a usable type
All Known Subinterfaces:
IProperty<K,L,M>
All Known Implementing Classes:
GuildProperty

public interface ImmutableProperty<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 Type
    Method
    Description
    get(F from)
    Get this property's data wrapped in an IPropertyMapping.
    default <U> U
    get(F from, Function<? super M,U> resolver)
    Get this property's value by applying the mapping into the resolver function.
    default <U> U
    get(F from, Supplier<U> fallback, Function<? super M,? extends U> resolver)
    Get this property's value by applying the mapping into the resolver function or returning the fallback suppliers value if the resolver's result is null.
    default <U> U
    get(F from, U fallback, Function<? super M,? extends U> resolver)
    Get this property's value by applying the mapping into the resolver function or returning the fallback value if the resolver's result is null.
    Get the key pointing to the property.
    boolean
    Check if this property is end user editable.
    boolean
    isPresent(F from)
    Check if this property is present.
  • Method Details

    • get

      @CheckForNull M get(@Nonnull F from)
      Get this property's data wrapped in an IPropertyMapping.
      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 the resolver function or returning the fallback suppliers value if the resolver's result is null.
      Type Parameters:
      U - - returned data type of the resolver
      Parameters:
      from - - property lookup data
      fallback - - supplier providing a fallback value
      resolver - - function to resolve the mapping into a usable data type
      Returns:
      Returns the property's value by applying it using the resolver function. If the result of the resolver function is null, the fallback supplier'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 the resolver function or returning the fallback value if the resolver's result is null.
      Type Parameters:
      U - - returned data type of the resolver
      Parameters:
      from - - property lookup data
      fallback - - fallback value
      resolver - - function to resolve the mapping into a usable data type
      Returns:
      Returns the property's value by applying it using the resolver function. If the result of the resolver function is null, the fallback value will be returned instead
    • get

      default <U> U get(@Nonnull F from, @Nonnull Function<? super M,U> resolver)
      Get this property's value by applying the mapping into the resolver function.
      Type Parameters:
      U - - returned data type of the resolver
      Parameters:
      from - - property lookup data
      resolver - - function to resolve the mapping into a usable data type
      Returns:
      Returns the property's value by applying the mapping into the resolver function.
    • getKey

      @Nonnull K getKey()
      Get the key pointing to the property.
      Returns:
      The property's key
    • isPresent

      boolean isPresent(@Nonnull F from)
      Check if this property is present.
      Parameters:
      from - - lookup data
      Returns:
      Returns true if the property was found using the provided lookup data
    • isEditable

      boolean isEditable()
      Check if this property is end user editable.
      Returns:
      Returns true if this property is allowed to be modified by the end user