Package net.luckperms.api.node
Interface NodeType<T extends Node>
public interface NodeType<T extends Node>
Represents a type of
Node
.-
Field Summary
Modifier 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 forChatMetaNode
orMetaNode
.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 TypeMethodDescriptionboolean
Returns 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 forChatMetaNode
orMetaNode
.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 givenNode
to the type defined by theNodeType
.An
IllegalArgumentException
is thrown if the node to cast does notmatch
the 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 givenNode
to the type defined by theNodeType
.Returns an
empty optional
if the node to cast does notmatch
the 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 aNode
matches
this type, and passes the givenand
Predicate
.- Parameters:
and
- a predicate to AND with the result of the type match check- Returns:
- a matching predicate, ANDed with the given predicate parameter
-