Package net.luckperms.api.query
Interface QueryOptions
-
@NonExtendable public interface QueryOptions
Represents the parameters for a lookup query.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interfaceQueryOptions.BuilderBuilder forQueryOptions.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description static @NonNull QueryOptions.Builderbuilder(@NonNull QueryMode mode)Creates a newQueryOptions.Builderfor the givenQueryMode.@NonNull ImmutableContextSetcontext()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 QueryOptionsdefaultContextualOptions()Gets the defaultcontextualquery options.booleanflag(@NonNull Flag flag)Gets if the givenFlagis set.@NonNull Set<Flag>flags()Gets theFlags which are set.@NonNull QueryModemode()Gets theQueryMode.static @NonNull QueryOptionsnonContextual()Gets the defaultnon contextualquery options.static @NonNull QueryOptionsnonContextual(@NonNull Set<Flag> flags)Creates anon contextualQueryOptionsinstance with the given flags.<O> @NonNull Optional<O>option(@NonNull OptionKey<O> key)Gets the value assigned to the givenOptionKey.@NonNull Map<OptionKey<?>,Object>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.@NonNull QueryOptions.BuildertoBuilder()Converts thisQueryOptionsto a mutable builder.
-
-
-
Method Detail
-
builder
static @NonNull QueryOptions.Builder builder(@NonNull QueryMode mode)
Creates a newQueryOptions.Builderfor the givenQueryMode.- Parameters:
mode- the query mode- Returns:
- a new builder
-
contextual
static @NonNull QueryOptions contextual(@NonNull ContextSet context, @NonNull Set<Flag> flags)
Creates acontextualQueryOptionsinstance with the given context and flags.- Parameters:
context- the contexts to query inflags- the query flags- Returns:
- the query options
-
contextual
static @NonNull QueryOptions contextual(@NonNull ContextSet context)
Creates acontextualQueryOptionsinstance with the given context and default flags.- Parameters:
context- the contexts to query in- Returns:
- the query options
-
nonContextual
static @NonNull QueryOptions nonContextual(@NonNull Set<Flag> flags)
Creates anon contextualQueryOptionsinstance with the given flags.- Parameters:
flags- the query flags- Returns:
- the query options
-
nonContextual
static @NonNull QueryOptions nonContextual()
Gets the defaultnon contextualquery options.This instance has the default set of flags.
- Returns:
- the default non contextual query options
-
defaultContextualOptions
static @NonNull QueryOptions 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
-
context
@NonNull ImmutableContextSet context()
Gets thecontext, if the options arecontextual.Throws
IllegalStateExceptionif themodeisQueryMode.NON_CONTEXTUAL.- Returns:
- the context
-
flag
boolean flag(@NonNull Flag flag)
Gets if the givenFlagis set.- Parameters:
flag- the flag- Returns:
- if the flag is set
-
option
<O> @NonNull Optional<O> option(@NonNull OptionKey<O> key)
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
@NonNull Map<OptionKey<?>,Object> options()
Gets the options which are set.- Returns:
- the options
-
satisfies
default boolean satisfies(@NonNull ContextSet contextSet)
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
-
-