Interface CachedMetaData

All Superinterfaces:
CachedData

public interface CachedMetaData extends CachedData
Holds cached meta lookup data for a specific set of contexts.

Meta data refers to prefixes, suffixes and meta (options) held by a permission holder.

All calls will account for inheritance, as well as any default data provided by the platform. These calls are heavily cached and are therefore fast.

  • Method Details

    • queryMetaValue

      @NonNull Result<String,MetaNode> queryMetaValue(@NonNull String key)
      Query a meta value for the given key.

      This method will always return a Result, but the inner result String will be null if a value for the given key was not found.

      Parameters:
      key - the key
      Returns:
      a result containing the value
      Since:
      5.4
    • getMetaValue

      default @Nullable String getMetaValue(@NonNull String key)
      Gets a value for the given meta key.

      If no such meta value exists for the given key, null is returned.

      Parameters:
      key - the key
      Returns:
      the value
    • getMetaValue

      default <T> @NonNull Optional<T> getMetaValue(@NonNull String key, @NonNull Function<String,? extends T> valueTransformer)
      Gets a value for the given meta key, and runs it through the given transformer.

      If no such meta value exists, an empty optional is returned. (the transformer will never be passed a null argument)

      The transformer is allowed to throw IllegalArgumentException or return null. This will also result in an empty optional being returned.

      For example, to parse and return an integer meta value, use:

           getMetaValue("my-int-val", Integer::parseInt).orElse(0);
       
      Type Parameters:
      T - the type of the transformed result
      Parameters:
      key - the key
      valueTransformer - the transformer used to transform the value
      Returns:
      the meta value
      Since:
      5.3
    • queryPrefix

      Query for a prefix.

      This method uses the rules defined by the prefix stack to produce a String output.

      Assuming the default configuration is used, this will usually be the value of the holder's highest priority prefix node.

      This method will always return a Result, but the inner result String will be null if a the resultant prefix stack contained no elements.

      Returns:
      a result containing the prefix
      Since:
      5.4
    • getPrefix

      default @Nullable String getPrefix()
      Gets the prefix.

      This method uses the rules defined by the prefix stack to produce a String output.

      Assuming the default configuration is used, this will usually be the value of the holder's highest priority prefix node.

      If the resultant prefix stack contained no elements, null is returned.

      Returns:
      a prefix string, or null
    • querySuffix

      Query for a suffix.

      This method uses the rules defined by the suffix stack to produce a String output.

      Assuming the default configuration is used, this will usually be the value of the holder's highest priority suffix node.

      This method will always return a Result, but the inner result String will be null if a the resultant suffix stack contained no elements.

      Returns:
      a result containing the suffix
      Since:
      5.4
    • getSuffix

      default @Nullable String getSuffix()
      Gets the suffix.

      This method uses the rules defined by the suffix stack to produce a String output.

      Assuming the default configuration is used, this will usually be the value of the holder's highest priority suffix node.

      If the resultant suffix stack contained no elements, null is returned.

      Returns:
      a suffix string, or null
    • getMeta

      Gets a map of all accumulated meta.

      Prefer using the getMetaValue(String) method for querying values.

      Returns:
      a map of meta
    • getPrefixes

      Gets a sorted map of all accumulated prefixes.

      Prefer using the getPrefix() method for querying.

      Returns:
      a sorted map of prefixes
    • getSuffixes

      Gets a sorted map of all accumulated suffixes.

      Prefer using the getSuffix() method for querying.

      Returns:
      a sorted map of suffixes
    • getPrimaryGroup

      @Nullable String getPrimaryGroup()
      Gets the name of the holders primary group.

      Will return null for Group holder types.

      Returns:
      the name of the primary group
      Since:
      5.1
    • getPrefixStackDefinition

      @NonNull MetaStackDefinition getPrefixStackDefinition()
      Gets the definition used for the prefix stack.
      Returns:
      the definition used for the prefix stack
    • getSuffixStackDefinition

      @NonNull MetaStackDefinition getSuffixStackDefinition()
      Gets the definition used for the suffix stack.
      Returns:
      the definition used for the suffix stack