Interface Result<T,N extends Node>

Type Parameters:
T - the result type
N - the node type

public interface Result<T,N extends Node>
Represents the result of a cached data lookup.

You can find "the holder that has the node that caused this result" using the following code:

 public static PermissionHolder.Identifier holderThatHasTheNodeThatCausedTheResult(Result<?, ?> result) {
     Node node = result.node();
     if (node == null) {
         return null;
     }
     InheritanceOriginMetadata origin = node.getMetadata(InheritanceOriginMetadata.KEY).orElse(null);
     if (origin == null) {
         return null;
     }
     return origin.getOrigin();
 }
 

Combined with the node itself, this is all the information needed to determine the root cause of the result.

The nullability of result() is purposely undefined to allow the flexibility for methods using Result to declare it. In general, if the T type has a nullable/undefined value, then the return of result() will be non-null, and if not, it will be nullable.

Since:
5.4
  • Method Summary

    Modifier and Type
    Method
    Description
    Gets the node that caused the result.
    Gets the underlying result.
  • Method Details

    • result

      T result()
      Gets the underlying result.
      Returns:
      the underlying result
    • node

      @Nullable N node()
      Gets the node that caused the result.
      Returns:
      the causing node