Interface SubjectRef.ToData<I>
-
- Type Parameters:
I- identifier type
- All Superinterfaces:
SubjectRef<I>
- Enclosing interface:
- SubjectRef<I>
public static interface SubjectRef.ToData<I> extends SubjectRef<I>
A resolved reference to a subject's data in a specific collection.- Since:
- 2.0.0
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface ca.stellardrift.permissionsex.subject.SubjectRef
SubjectRef.ToData<I>
-
-
Field Summary
-
Fields inherited from interface ca.stellardrift.permissionsex.subject.SubjectRef
TYPE
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description ImmutableSubjectDataget()Get the current subject data.booleanholdsListenersStrongly()Get whether or not this reference will hold strong references to stored listeners.CompletableFuture<Boolean>isRegistered()Confirm whether or not the subject data referenced is actually registered.voidonUpdate(Consumer<ImmutableSubjectData> listener)Register a listener to be called when an update is performed.CompletableFuture<ImmutableSubjectData>remove()Remove the subject data referenced.CompletableFuture<Change<ImmutableSubjectData>>update(UnaryOperator<ImmutableSubjectData> modifierFunc)Update the contained data based on the result of a function.default CompletableFuture<Change<ImmutableSubjectData>>update(Set<ContextValue<?>> contexts, UnaryOperator<Segment> modifierFunc)Update a single segment of the contained data based on the provided operator.-
Methods inherited from interface ca.stellardrift.permissionsex.subject.SubjectRef
identifier, serializedIdentifier, type
-
-
-
-
Method Detail
-
get
ImmutableSubjectData get()
Get the current subject data.- Returns:
- The current data
- Since:
- 2.0.0
-
update
CompletableFuture<Change<ImmutableSubjectData>> update(UnaryOperator<ImmutableSubjectData> modifierFunc)
Update the contained data based on the result of a function.- Parameters:
modifierFunc- The function that will be called to update the data- Returns:
- A future completing when data updates have been written to the data store
- Since:
- 2.0.0
-
update
default CompletableFuture<Change<ImmutableSubjectData>> update(Set<ContextValue<?>> contexts, UnaryOperator<Segment> modifierFunc)
Update a single segment of the contained data based on the provided operator.- Parameters:
contexts- the contexts to update inmodifierFunc- the function that will be called to update the data- Returns:
- A future completing when data updates have been written to the data store
- Since:
- 2.0.0
-
holdsListenersStrongly
boolean holdsListenersStrongly()
Get whether or not this reference will hold strong references to stored listeners. If the return value is false, registering a listener object with this reference will not prevent it from being garbage collected, so the listener must be held somewhere else for it to continue being called.- Returns:
- Whether or not listeners are held strongly.
- Since:
- 2.0.0
-
onUpdate
void onUpdate(Consumer<ImmutableSubjectData> listener)
Register a listener to be called when an update is performed.- Parameters:
listener- The listener to register- Since:
- 2.0.0
-
isRegistered
CompletableFuture<Boolean> isRegistered()
Confirm whether or not the subject data referenced is actually registered.- Returns:
- a future completing with registration state
- Since:
- 2.0.0
-
remove
CompletableFuture<ImmutableSubjectData> remove()
Remove the subject data referenced.- Returns:
- A future completing with the previous data for this subject.
- Since:
- 2.0.0
- See Also:
SubjectDataCache.remove(Object)
-
-