Package net.luckperms.api.query
Interface QueryOptions
Represents the parameters for a lookup query.
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionstatic @NonNull QueryOptions.BuilderCreates a newQueryOptions.Builderfor the givenQueryMode.context()Gets thecontext, if the options arecontextual.static @NonNull QueryOptionscontextual(@NonNull ContextSet context) Creates acontextualQueryOptionsinstance with the given context and default flags.static @NonNull QueryOptionscontextual(@NonNull ContextSet context, @NonNull Set<Flag> flags) Creates acontextualQueryOptionsinstance with the given context and flags.static @NonNull QueryOptionsGets the defaultcontextualquery options.booleanGets if the givenFlagis set.flags()Gets theFlags which are set.mode()Gets theQueryMode.static @NonNull QueryOptionsGets the defaultnon contextualquery options.static @NonNull QueryOptionsnonContextual(@NonNull Set<Flag> flags) Creates anon contextualQueryOptionsinstance with the given flags.Gets the value assigned to the givenOptionKey.options()Gets the options which are set.default booleansatisfies(@NonNull ContextSet contextSet) Gets whether thisQueryOptionssatisfies the given requiredcontext.booleansatisfies(@NonNull ContextSet contextSet, @NonNull ContextSatisfyMode defaultContextSatisfyMode) Gets whether thisQueryOptionssatisfies the given requiredcontext.Converts thisQueryOptionsto a mutable builder.
-
Method Details
-
builder
Creates a newQueryOptions.Builderfor the givenQueryMode.- Parameters:
mode- the query mode- Returns:
- a new builder
-
contextual
Creates acontextualQueryOptionsinstance with the given context and flags.- Parameters:
context- the contexts to query inflags- the query flags- Returns:
- the query options
-
contextual
Creates acontextualQueryOptionsinstance with the given context and default flags.- Parameters:
context- the contexts to query in- Returns:
- the query options
-
nonContextual
Creates anon contextualQueryOptionsinstance with the given flags.- Parameters:
flags- the query flags- Returns:
- the query options
-
nonContextual
Gets the defaultnon contextualquery options.This instance has the default set of flags.
- Returns:
- the default non contextual query options
-
defaultContextualOptions
Gets the defaultcontextualquery options.This instance has the default set of flags, and an empty set of contexts.
- Returns:
- the default contextual query options
-
mode
Gets theQueryMode.- Returns:
- the query mode
-
context
@NonNull ImmutableContextSet context()Gets thecontext, if the options arecontextual.Throws
IllegalStateExceptionif themodeisQueryMode.NON_CONTEXTUAL.- Returns:
- the context
-
flag
Gets if the givenFlagis set.- Parameters:
flag- the flag- Returns:
- if the flag is set
-
flags
Gets theFlags which are set.- Returns:
- the flags
-
option
Gets the value assigned to the givenOptionKey.Returns an
empty optionalif the option has not been set.- Type Parameters:
O- the option type- Parameters:
key- the key to lookup- Returns:
- the value assigned to the key
-
options
Gets the options which are set.- Returns:
- the options
-
satisfies
Gets whether thisQueryOptionssatisfies the given requiredcontext.ContextSatisfyMode.AT_LEAST_ONE_VALUE_PER_KEYis used if thisQueryOptionsinstance doesn't have theoption keyset.- Parameters:
contextSet- the contexts- Returns:
- the result
-
satisfies
boolean satisfies(@NonNull ContextSet contextSet, @NonNull ContextSatisfyMode defaultContextSatisfyMode) Gets whether thisQueryOptionssatisfies the given requiredcontext.The
defaultContextSatisfyModeparameter is used if thisQueryOptionsinstance doesn't have theoption keyset.- Parameters:
contextSet- the contextsdefaultContextSatisfyMode- the default context satisfy mode to use- Returns:
- the result
- Since:
- 5.2
-
toBuilder
@NonNull QueryOptions.Builder toBuilder()Converts thisQueryOptionsto a mutable builder.- Returns:
- a builder, with the same properties already set
-