Package net.luckperms.api.node
Interface NodeType<T extends Node>
public interface NodeType<T extends Node>
Represents a type of
Node.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final NodeType<ChatMetaNode<?,?>> Node type forChatMetaNode.static final NodeType<DisplayNameNode>Node type forDisplayNameNode.static final NodeType<InheritanceNode>Node type forInheritanceNode.Node type forMetaNode.Node type forChatMetaNodeorMetaNode.static final NodeType<PermissionNode>Node type forPermissionNode.static final NodeType<PrefixNode>Node type forPrefixNode.static final NodeType<RegexPermissionNode>Node type forRegexPermissionNode.static final NodeType<SuffixNode>Node type forSuffixNode.static final NodeType<WeightNode>Node type forWeightNode. -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns if the passed node matches the typename()Gets a name for the node type.
-
Field Details
-
PERMISSION
Node type forPermissionNode. -
REGEX_PERMISSION
Node type forRegexPermissionNode. -
INHERITANCE
Node type forInheritanceNode. -
PREFIX
Node type forPrefixNode. -
SUFFIX
Node type forSuffixNode. -
META
Node type forMetaNode. -
WEIGHT
Node type forWeightNode. -
DISPLAY_NAME
Node type forDisplayNameNode. -
CHAT_META
Node type forChatMetaNode.This is an abstract type, and therefore will never be returned from
Node.getType(). -
META_OR_CHAT_META
Node type forChatMetaNodeorMetaNode.This is an abstract type, and therefore will never be returned from
Node.getType().
-
-
Method Details
-
name
Gets a name for the node type.- Returns:
- a name
-
matches
Returns if the passed node matches the type- Parameters:
node- the node to test- Returns:
- true if the node has the same type
-
cast
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
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
- Returns:
- a predicate for the
matches(Node)method.
-
predicate
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
-