Package net.luckperms.api.cacheddata
Interface Result<T,N extends Node>
- Type Parameters:
T- the result typeN- 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 staticPermissionHolder.IdentifierholderThatHasTheNodeThatCausedTheResult(Result<?, ?> result) {Nodenode = result.node(); if (node == null) { return null; }InheritanceOriginMetadataorigin = 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
-
Method Details
-
result
T result()Gets the underlying result.- Returns:
- the underlying result
-
node
Gets the node that caused the result.- Returns:
- the causing node
-