public class NodeTree extends Object
This class is simply provided as a utility for plugins implementing
PermissionService
. It is not a requirement that this class is used,
however the behaviour defined in Subject
regarding implicit node
inheritance should be maintained.
Modifier and Type | Method and Description |
---|---|
Map<String,Boolean> |
asMap()
Convert this node tree into a map of the defined nodes in this tree.
|
Tristate |
get(String node)
Returns the value assigned to a specific node, or the nearest parent
value in the tree if the node itself is undefined.
|
static NodeTree |
of(Map<String,Boolean> values)
Create a new node tree with the given values, and a default value of
Tristate.UNDEFINED . |
static NodeTree |
of(Map<String,Boolean> values,
Tristate defaultValue)
Create a new node tree with the given values, and the specified root
fallback value.
|
NodeTree |
withAll(Map<String,Tristate> values)
Return a modified new node tree with the specified values set.
|
NodeTree |
withValue(String node,
Tristate value)
Return a new NodeTree instance with a single changed value.
|
public static NodeTree of(Map<String,Boolean> values)
Tristate.UNDEFINED
.values
- The values to setpublic static NodeTree of(Map<String,Boolean> values, Tristate defaultValue)
values
- The values to be contained in this node treedefaultValue
- The fallback value for any completely undefined nodespublic Tristate get(String node)
node
- The path to get the node value atpublic Map<String,Boolean> asMap()
public NodeTree withValue(String node, Tristate value)
node
- The node path to change the value ofvalue
- The value to change, or UNDEFINED to remove