Package net.luckperms.api.node
Interface NodeType<T extends Node>
-
-
Field Summary
Fields Modifier and Type Field Description static NodeType<ChatMetaNode<?,?>>CHAT_METANode type forChatMetaNode.static NodeType<DisplayNameNode>DISPLAY_NAMENode type forDisplayNameNode.static NodeType<InheritanceNode>INHERITANCENode type forInheritanceNode.static NodeType<MetaNode>METANode type forMetaNode.static NodeType<Node>META_OR_CHAT_METANode type forChatMetaNodeorMetaNode.static NodeType<PermissionNode>PERMISSIONNode type forPermissionNode.static NodeType<PrefixNode>PREFIXNode type forPrefixNode.static NodeType<RegexPermissionNode>REGEX_PERMISSIONNode type forRegexPermissionNode.static NodeType<SuffixNode>SUFFIXNode type forSuffixNode.static NodeType<WeightNode>WEIGHTNode type forWeightNode.
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description Tcast(Node node)booleanmatches(Node node)Returns if the passed node matches the typeStringname()Gets a name for the node type.default Predicate<Node>predicate()default Predicate<Node>predicate(Predicate<? super T> and)default Optional<T>tryCast(Node node)
-
-
-
Field Detail
-
PERMISSION
static final NodeType<PermissionNode> PERMISSION
Node type forPermissionNode.
-
REGEX_PERMISSION
static final NodeType<RegexPermissionNode> REGEX_PERMISSION
Node type forRegexPermissionNode.
-
INHERITANCE
static final NodeType<InheritanceNode> INHERITANCE
Node type forInheritanceNode.
-
PREFIX
static final NodeType<PrefixNode> PREFIX
Node type forPrefixNode.
-
SUFFIX
static final NodeType<SuffixNode> SUFFIX
Node type forSuffixNode.
-
WEIGHT
static final NodeType<WeightNode> WEIGHT
Node type forWeightNode.
-
DISPLAY_NAME
static final NodeType<DisplayNameNode> DISPLAY_NAME
Node type forDisplayNameNode.
-
CHAT_META
static final NodeType<ChatMetaNode<?,?>> CHAT_META
Node type forChatMetaNode.
-
META_OR_CHAT_META
static final NodeType<Node> META_OR_CHAT_META
Node type forChatMetaNodeorMetaNode.
-
-
Method Detail
-
name
String name()
Gets a name for the node type.- Returns:
- a name
-
matches
boolean matches(Node node)
Returns if the passed node matches the type- Parameters:
node- the node to test- Returns:
- true if the node has the same type
-
cast
T cast(Node node)
Casts the givenNodeto the type defined by theNodeType.An
IllegalArgumentExceptionis thrown if the node to cast does notmatchthe type.- Parameters:
node- the node to cast- Returns:
- the casted node
- Throws:
IllegalArgumentException- if the node to cast does not match the type
-
tryCast
default Optional<T> tryCast(Node node)
Attempts to cast the givenNodeto the type defined by theNodeType.Returns an
empty optionalif the node to cast does notmatchthe type.- Parameters:
node- the node to cast- Returns:
- an optional, possibly containing a casted node
-
predicate
default Predicate<Node> predicate()
- Returns:
- a predicate for the
matches(Node)method.
-
predicate
default Predicate<Node> predicate(Predicate<? super T> and)
Returns aPredicate, returning whether aNodematchesthis type, and passes the givenandPredicate.- Parameters:
and- a predicate to AND with the result of the type match check- Returns:
- a matching predicate, ANDed with the given predicate parameter
-
-