Interface NodeMap
-
public interface NodeMapEncapsulates a store of data (Nodes) within aPermissionHolder.The effect of any mutate operation will not persist in storage unless changes are explicitly saved. If changes are not saved, the effect will only be observed until the next time the holders permission data is (re)loaded. Changes to
Users should be saved usingUserManager.saveUser(User), and changes toGroups should be saved usingGroupManager.saveGroup(Group).Before making changes to a user or group, it may be a good idea to load a fresh copy of the backing data from the storage if you haven't done so already, to avoid overwriting changes made already. This can be done via
UserManager.loadUser(UUID)orGroupManager.loadGroup(String)respectively.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description @NonNull DataMutateResultadd(@NonNull Node node)Adds a node.@NonNull DataMutateResult.WithMergedNodeadd(@NonNull Node node, @NonNull TemporaryNodeMergeStrategy temporaryNodeMergeStrategy)Adds a node.voidclear()Clears all nodes.voidclear(@NonNull Predicate<? super Node> test)Clears any nodes which pass the predicate.voidclear(@NonNull ContextSet contextSet)Clears all nodes in a specific context.voidclear(@NonNull ContextSet contextSet, @NonNull Predicate<? super Node> test)Clears all nodes in a specific context which pass the predicate.@NonNull Tristatecontains(@NonNull Node node, @NonNull NodeEqualityPredicate equalityPredicate)Gets if this instance contains a givenNode.@NonNull DataMutateResultremove(@NonNull Node node)Removes a node.@NonNull @Unmodifiable Collection<Node>toCollection()Gets a flattened view ofNodes contained within this instance.@NonNull @Unmodifiable Map<ImmutableContextSet,Collection<Node>>toMap()
-
-
-
Method Detail
-
toMap
@NonNull @Unmodifiable Map<ImmutableContextSet,Collection<Node>> toMap()
- Returns:
- a map of nodes
-
toCollection
@NonNull @Unmodifiable Collection<Node> toCollection()
Gets a flattened view ofNodes contained within this instance.Effectively combines the value collections of the map returned by
toMap().- Returns:
- a flattened collection of nodes
-
contains
@NonNull Tristate contains(@NonNull Node node, @NonNull NodeEqualityPredicate equalityPredicate)
Gets if this instance contains a givenNode.Returns
Tristate.UNDEFINEDif the instance does not contain the node, and theassigned valueof the node as aTristateif it is present.- Parameters:
node- the node to check forequalityPredicate- how to determine if a node matches- Returns:
- a Tristate relating to the assigned state of the node
- Throws:
NullPointerException- if the node is null
-
add
@NonNull DataMutateResult add(@NonNull Node node)
Adds a node.- Parameters:
node- the node to be add- Returns:
- the result of the operation
-
add
@NonNull DataMutateResult.WithMergedNode add(@NonNull Node node, @NonNull TemporaryNodeMergeStrategy temporaryNodeMergeStrategy)
Adds a node.- Parameters:
node- the node to addtemporaryNodeMergeStrategy- the strategy used to merge temporary permission entries- Returns:
- the result of the operation
-
remove
@NonNull DataMutateResult remove(@NonNull Node node)
Removes a node.- Parameters:
node- the node to remove- Returns:
- the result of the operation
-
clear
void clear()
Clears all nodes.
-
clear
void clear(@NonNull Predicate<? super Node> test)
Clears any nodes which pass the predicate.- Parameters:
test- the predicate to test for nodes which should be removed
-
clear
void clear(@NonNull ContextSet contextSet)
Clears all nodes in a specific context.- Parameters:
contextSet- the contexts to filter by
-
clear
void clear(@NonNull ContextSet contextSet, @NonNull Predicate<? super Node> test)
Clears all nodes in a specific context which pass the predicate.- Parameters:
contextSet- the contexts to filter bytest- the predicate to test for nodes which should be removed
-
-