Class ImmutableFlagDescriptor
java.lang.Object
org.incendo.cloud.annotations.descriptor.ImmutableFlagDescriptor
- All Implemented Interfaces:
Descriptor,FlagDescriptor
@Generated("org.immutables.processor.ProxyProcessor")
@API(status=STABLE,
consumers="org.incendo.cloud.*")
public final class ImmutableFlagDescriptor
extends Object
implements FlagDescriptor
Immutable implementation of
FlagDescriptor.
Use the builder to create immutable instances:
ImmutableFlagDescriptor.builder().
Use the static factory method to create immutable instances:
ImmutableFlagDescriptor.of().
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classBuilds instances of typeImmutableFlagDescriptor. -
Method Summary
Modifier and TypeMethodDescriptionaliases()Returns an unmodifiable view of the flag aliases.builder()Creates a builder forImmutableFlagDescriptor.static ImmutableFlagDescriptorcopyOf(FlagDescriptor instance) Creates an immutable copy of aFlagDescriptorvalue.Returns the description of the flag.booleanThis instance is equal to all instances ofImmutableFlagDescriptorthat have equal attribute values.inthashCode()Computes a hash code from attributes:parameter,name,aliases,parserName,suggestions,permission,description,repeatable.name()Returns the flag name.static ImmutableFlagDescriptorof(@NonNull Parameter parameter, @NonNull String name, @NonNull Collection<String> aliases, @Nullable String parserName, @Nullable String suggestions, @Nullable Permission permission, @Nullable Description description, boolean repeatable) Construct a new immutableFlagDescriptorinstance.Returns the parameter.Returns the name of the parser to use.Returns the permission of the flag.booleanReturns whether the flag is repeatable.Returns the name of the suggestion provider to use.toString()Prints the immutable valueFlagDescriptorwith attribute values.final ImmutableFlagDescriptorwithAliases(@NonNull Collection<String> value) Copy the current immutable object by setting a value for thealiasesattribute.final ImmutableFlagDescriptorwithDescription(@Nullable Description value) Copy the current immutable object by setting a value for thedescriptionattribute.final ImmutableFlagDescriptorCopy the current immutable object by setting a value for thenameattribute.final ImmutableFlagDescriptorwithParameter(@NonNull Parameter value) Copy the current immutable object by setting a value for theparameterattribute.final ImmutableFlagDescriptorwithParserName(@Nullable String value) Copy the current immutable object by setting a value for theparserNameattribute.final ImmutableFlagDescriptorwithPermission(@Nullable Permission value) Copy the current immutable object by setting a value for thepermissionattribute.final ImmutableFlagDescriptorwithRepeatable(boolean value) Copy the current immutable object by setting a value for therepeatableattribute.final ImmutableFlagDescriptorwithSuggestions(@Nullable String value) Copy the current immutable object by setting a value for thesuggestionsattribute.
-
Method Details
-
parameter
Returns the parameter.- Specified by:
parameterin interfaceFlagDescriptor- Returns:
- the parameter
-
name
Returns the flag name.- Specified by:
namein interfaceDescriptor- Specified by:
namein interfaceFlagDescriptor- Returns:
- the flag name
-
aliases
Returns an unmodifiable view of the flag aliases.- Specified by:
aliasesin interfaceFlagDescriptor- Returns:
- the flag aliases
-
parserName
Returns the name of the parser to use. Ifnullthe default parser for the parameter type will be used.- Specified by:
parserNamein interfaceFlagDescriptor- Returns:
- the parser name, or
null
-
suggestions
Returns the name of the suggestion provider to use. If the string isnull, the default provider for the argument parser will be used. Otherwise, theParserRegistryinstance in theCommandManagerwill be queried for a matching suggestion provider.For this to work, the suggestion needs to be registered in the parser registry. To do this, use
ParserRegistry.registerSuggestionProvider(String, SuggestionProvider). The registry instance can be retrieved usingCommandManager.parserRegistry().- Specified by:
suggestionsin interfaceFlagDescriptor- Returns:
- the name of the suggestion provider, or
null
-
permission
Returns the permission of the flag.- Specified by:
permissionin interfaceFlagDescriptor- Returns:
- the flag permission, or
null
-
description
Returns the description of the flag.- Specified by:
descriptionin interfaceFlagDescriptor- Returns:
- the flag description, or
null
-
repeatable
public boolean repeatable()Returns whether the flag is repeatable.- Specified by:
repeatablein interfaceFlagDescriptor- Returns:
- whether the flag is repeatable
-
withParameter
Copy the current immutable object by setting a value for theparameterattribute. A shallow reference equality check is used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for parameter- Returns:
- A modified copy of the
thisobject
-
withName
Copy the current immutable object by setting a value for thenameattribute. An equals check used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for name- Returns:
- A modified copy of the
thisobject
-
withAliases
Copy the current immutable object by setting a value for thealiasesattribute. A shallow reference equality check is used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for aliases- Returns:
- A modified copy of the
thisobject
-
withParserName
Copy the current immutable object by setting a value for theparserNameattribute. An equals check used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for parserName (can benull)- Returns:
- A modified copy of the
thisobject
-
withSuggestions
Copy the current immutable object by setting a value for thesuggestionsattribute. An equals check used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for suggestions (can benull)- Returns:
- A modified copy of the
thisobject
-
withPermission
Copy the current immutable object by setting a value for thepermissionattribute. A shallow reference equality check is used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for permission (can benull)- Returns:
- A modified copy of the
thisobject
-
withDescription
Copy the current immutable object by setting a value for thedescriptionattribute. A shallow reference equality check is used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for description (can benull)- Returns:
- A modified copy of the
thisobject
-
withRepeatable
Copy the current immutable object by setting a value for therepeatableattribute. A value equality check is used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for repeatable- Returns:
- A modified copy of the
thisobject
-
equals
This instance is equal to all instances ofImmutableFlagDescriptorthat have equal attribute values. -
hashCode
public int hashCode()Computes a hash code from attributes:parameter,name,aliases,parserName,suggestions,permission,description,repeatable. -
toString
Prints the immutable valueFlagDescriptorwith attribute values. -
of
public static ImmutableFlagDescriptor of(@NonNull Parameter parameter, @NonNull String name, @NonNull Collection<String> aliases, @Nullable String parserName, @Nullable String suggestions, @Nullable Permission permission, @Nullable Description description, boolean repeatable) Construct a new immutableFlagDescriptorinstance.- Parameters:
parameter- The value for theparameterattributename- The value for thenameattributealiases- The value for thealiasesattributeparserName- The value for theparserNameattributesuggestions- The value for thesuggestionsattributepermission- The value for thepermissionattributedescription- The value for thedescriptionattributerepeatable- The value for therepeatableattribute- Returns:
- An immutable FlagDescriptor instance
-
copyOf
Creates an immutable copy of aFlagDescriptorvalue. Uses accessors to get values to initialize the new immutable instance. If an instance is already immutable, it is returned as is.- Parameters:
instance- The instance to copy- Returns:
- A copied immutable FlagDescriptor instance
-
builder
Creates a builder forImmutableFlagDescriptor.ImmutableFlagDescriptor.builder() .parameter(reflect.@org.checkerframework.checker.nullness.qual.NonNull Parameter) // requiredparameter.name(@org.checkerframework.checker.nullness.qual.NonNull String) // requiredname.aliases(@org.checkerframework.checker.nullness.qual.NonNull Collection<String>) // requiredaliases.parserName(@org.checkerframework.checker.nullness.qual.Nullable String | null) // nullableparserName.suggestions(@org.checkerframework.checker.nullness.qual.Nullable String | null) // nullablesuggestions.permission(org.incendo.cloud.permission.@org.checkerframework.checker.nullness.qual.Nullable Permission | null) // nullablepermission.description(org.incendo.cloud.description.@org.checkerframework.checker.nullness.qual.Nullable Description | null) // nullabledescription.repeatable(boolean) // requiredrepeatable.build();- Returns:
- A new ImmutableFlagDescriptor builder
-