Class ImmutableArgumentDescriptor
java.lang.Object
org.incendo.cloud.annotations.descriptor.ImmutableArgumentDescriptor
- All Implemented Interfaces:
ArgumentDescriptor,Descriptor
@Generated(from="ArgumentDescriptor",
generator="Immutables")
@Generated("org.immutables.processor.ProxyProcessor")
@API(status=STABLE,
consumers="org.incendo.cloud.*")
public final class ImmutableArgumentDescriptor
extends Object
implements ArgumentDescriptor
Immutable implementation of
ArgumentDescriptor.
Use the builder to create immutable instances:
ImmutableArgumentDescriptor.builder().
Use the static factory method to create immutable instances:
ImmutableArgumentDescriptor.of().
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classBuilds instances of typeImmutableArgumentDescriptor. -
Method Summary
Modifier and TypeMethodDescriptionbuilder()Creates a builder forImmutableArgumentDescriptor.static ImmutableArgumentDescriptorcopyOf(ArgumentDescriptor instance) Creates an immutable copy of aArgumentDescriptorvalue.@Nullable DefaultValue<?, ?> Returns the default value.Returns the description of the argument.booleanThis instance is equal to all instances ofImmutableArgumentDescriptorthat have equal attribute values.inthashCode()Computes a hash code from attributes:parameter,name,parserName,suggestions,defaultValue,description.name()Returns the argument namestatic ImmutableArgumentDescriptorof(@NonNull Parameter parameter, @NonNull String name, @Nullable String parserName, @Nullable String suggestions, @Nullable DefaultValue<?, ?> defaultValue, @Nullable Description description) Construct a new immutableArgumentDescriptorinstance.Returns the parameter.Returns the name of the parser to use.Returns the name of the suggestion provider to use.toString()Prints the immutable valueArgumentDescriptorwith attribute values.withDefaultValue(@Nullable DefaultValue<?, ?> value) Copy the current immutable object by setting a value for thedefaultValueattribute.withDescription(@Nullable Description value) Copy the current immutable object by setting a value for thedescriptionattribute.Copy the current immutable object by setting a value for thenameattribute.withParameter(@NonNull Parameter value) Copy the current immutable object by setting a value for theparameterattribute.withParserName(@Nullable String value) Copy the current immutable object by setting a value for theparserNameattribute.withSuggestions(@Nullable String value) Copy the current immutable object by setting a value for thesuggestionsattribute.
-
Method Details
-
parameter
Returns the parameter.- Specified by:
parameterin interfaceArgumentDescriptor- Returns:
- the parameter
-
name
Returns the argument name- Specified by:
namein interfaceArgumentDescriptor- Specified by:
namein interfaceDescriptor- Returns:
- the argument name
-
parserName
Returns the name of the parser to use. Ifnullthe default parser for the parameter type will be used.- Specified by:
parserNamein interfaceArgumentDescriptor- 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 interfaceArgumentDescriptor- Returns:
- the name of the suggestion provider, or
null
-
defaultValue
Returns the default value.- Specified by:
defaultValuein interfaceArgumentDescriptor- Returns:
- the default value, or
null
-
description
Returns the description of the argument.- Specified by:
descriptionin interfaceArgumentDescriptor- Returns:
- the argument description, or
null
-
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 or 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 or 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 or 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 or the
thisobject
-
withDefaultValue
Copy the current immutable object by setting a value for thedefaultValueattribute. A shallow reference equality check is used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for defaultValue (can benull)- Returns:
- A modified copy or 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 or the
thisobject
-
equals
This instance is equal to all instances ofImmutableArgumentDescriptorthat have equal attribute values. -
hashCode
public int hashCode()Computes a hash code from attributes:parameter,name,parserName,suggestions,defaultValue,description. -
toString
Prints the immutable valueArgumentDescriptorwith attribute values. -
of
public static ImmutableArgumentDescriptor of(@NonNull Parameter parameter, @NonNull String name, @Nullable String parserName, @Nullable String suggestions, @Nullable DefaultValue<?, ?> defaultValue, @Nullable Description description) Construct a new immutableArgumentDescriptorinstance.- Parameters:
parameter- The value for theparameterattributename- The value for thenameattributeparserName- The value for theparserNameattributesuggestions- The value for thesuggestionsattributedefaultValue- The value for thedefaultValueattributedescription- The value for thedescriptionattribute- Returns:
- An immutable ArgumentDescriptor instance
-
copyOf
Creates an immutable copy of aArgumentDescriptorvalue. 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 ArgumentDescriptor instance
-
builder
Creates a builder forImmutableArgumentDescriptor.ImmutableArgumentDescriptor.builder() .parameter(reflect.Parameter) // requiredparameter.name(String) // requiredname.parserName(String | null) // nullableparserName.suggestions(String | null) // nullablesuggestions.defaultValue(org.incendo.cloud.component.DefaultValue<?, ?> | null) // nullabledefaultValue.description(org.incendo.cloud.description.Description | null) // nullabledescription.build();- Returns:
- A new ImmutableArgumentDescriptor builder
-