Class ImmutableCommandDescriptor
java.lang.Object
org.incendo.cloud.annotations.descriptor.ImmutableCommandDescriptor
- All Implemented Interfaces:
CommandDescriptor,Descriptor
@Generated("org.immutables.processor.ProxyProcessor")
@API(status=STABLE,
consumers="org.incendo.cloud.*")
public final class ImmutableCommandDescriptor
extends Object
implements CommandDescriptor
Immutable implementation of
CommandDescriptor.
Use the builder to create immutable instances:
ImmutableCommandDescriptor.builder().
Use the static factory method to create immutable instances:
ImmutableCommandDescriptor.of().
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classBuilds instances of typeImmutableCommandDescriptor. -
Method Summary
Modifier and TypeMethodDescriptionbuilder()Creates a builder forImmutableCommandDescriptor.Returns the root command name.static ImmutableCommandDescriptorcopyOf(CommandDescriptor instance) Creates an immutable copy of aCommandDescriptorvalue.booleanThis instance is equal to all instances ofImmutableCommandDescriptorthat have equal attribute values.inthashCode()Computes a hash code from attributes:method,name,syntax,commandToken,requiredSender.method()Returns the command method.name()Returns the name of the object described bythisdescriptor.static ImmutableCommandDescriptorof(@NonNull Method method, @NonNull String name, Iterable<? extends SyntaxFragment> syntax, @NonNull String commandToken, @NonNull Class<?> requiredSender) Construct a new immutableCommandDescriptorinstance.static ImmutableCommandDescriptorof(@NonNull Method method, @NonNull String name, @NonNull List<SyntaxFragment> syntax, @NonNull String commandToken, @NonNull Class<?> requiredSender) Construct a new immutableCommandDescriptorinstance.Returns the required sender type.syntax()Returns an unmodifiable view of the syntax fragments.toString()Prints the immutable valueCommandDescriptorwith attribute values.withCommandToken(@NonNull String value) Copy the current immutable object by setting a value for thecommandTokenattribute.withMethod(@NonNull Method value) Copy the current immutable object by setting a value for themethodattribute.Copy the current immutable object by setting a value for thenameattribute.withRequiredSender(@NonNull Class<?> value) Copy the current immutable object by setting a value for therequiredSenderattribute.withSyntax(Iterable<? extends SyntaxFragment> elements) Copy the current immutable object with elements that replace the content ofsyntax.withSyntax(SyntaxFragment... elements) Copy the current immutable object with elements that replace the content ofsyntax.
-
Method Details
-
method
Returns the command method.- Specified by:
methodin interfaceCommandDescriptor- Returns:
- the command method
-
name
Description copied from interface:DescriptorReturns the name of the object described bythisdescriptor.- Specified by:
namein interfaceCommandDescriptor- Specified by:
namein interfaceDescriptor- Returns:
- The value of the
nameattribute
-
syntax
Returns an unmodifiable view of the syntax fragments.- Specified by:
syntaxin interfaceCommandDescriptor- Returns:
- the syntax fragments
-
commandToken
Returns the root command name.- Specified by:
commandTokenin interfaceCommandDescriptor- Returns:
- the name of the root command
-
requiredSender
Returns the required sender type.- Specified by:
requiredSenderin interfaceCommandDescriptor- Returns:
- the required sender type
-
withMethod
Copy the current immutable object by setting a value for themethodattribute. A shallow reference equality check is used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for method- 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
-
withSyntax
Copy the current immutable object with elements that replace the content ofsyntax.- Parameters:
elements- The elements to set- Returns:
- A modified copy of
thisobject
-
withSyntax
Copy the current immutable object with elements that replace the content ofsyntax. A shallow reference equality check is used to prevent copying of the same value by returningthis.- Parameters:
elements- An iterable of syntax elements to set- Returns:
- A modified copy of
thisobject
-
withCommandToken
Copy the current immutable object by setting a value for thecommandTokenattribute. An equals check used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for commandToken- Returns:
- A modified copy of the
thisobject
-
withRequiredSender
Copy the current immutable object by setting a value for therequiredSenderattribute. A shallow reference equality check is used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for requiredSender- Returns:
- A modified copy of the
thisobject
-
equals
This instance is equal to all instances ofImmutableCommandDescriptorthat have equal attribute values. -
hashCode
public int hashCode()Computes a hash code from attributes:method,name,syntax,commandToken,requiredSender. -
toString
Prints the immutable valueCommandDescriptorwith attribute values. -
of
public static ImmutableCommandDescriptor of(@NonNull Method method, @NonNull String name, @NonNull List<SyntaxFragment> syntax, @NonNull String commandToken, @NonNull Class<?> requiredSender) Construct a new immutableCommandDescriptorinstance.- Parameters:
method- The value for themethodattributename- The value for thenameattributesyntax- The value for thesyntaxattributecommandToken- The value for thecommandTokenattributerequiredSender- The value for therequiredSenderattribute- Returns:
- An immutable CommandDescriptor instance
-
of
public static ImmutableCommandDescriptor of(@NonNull Method method, @NonNull String name, Iterable<? extends SyntaxFragment> syntax, @NonNull String commandToken, @NonNull Class<?> requiredSender) Construct a new immutableCommandDescriptorinstance.- Parameters:
method- The value for themethodattributename- The value for thenameattributesyntax- The value for thesyntaxattributecommandToken- The value for thecommandTokenattributerequiredSender- The value for therequiredSenderattribute- Returns:
- An immutable CommandDescriptor instance
-
copyOf
Creates an immutable copy of aCommandDescriptorvalue. 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 CommandDescriptor instance
-
builder
Creates a builder forImmutableCommandDescriptor.ImmutableCommandDescriptor.builder() .method(reflect.@org.checkerframework.checker.nullness.qual.NonNull Method) // requiredmethod.name(@org.checkerframework.checker.nullness.qual.NonNull String) // optionalname.addSyntax|addAllSyntax(org.incendo.cloud.annotations.SyntaxFragment) //syntaxelements .commandToken(@org.checkerframework.checker.nullness.qual.NonNull String) // requiredcommandToken.requiredSender(@org.checkerframework.checker.nullness.qual.NonNull Class<?>) // requiredrequiredSender.build();- Returns:
- A new ImmutableCommandDescriptor builder
-