Class ImmutableCommandDescriptor.Builder
java.lang.Object
org.incendo.cloud.annotations.descriptor.ImmutableCommandDescriptor.Builder
- Enclosing class:
ImmutableCommandDescriptor
@Generated(from="CommandDescriptor",
generator="Immutables")
public static final class ImmutableCommandDescriptor.Builder
extends Object
Builds instances of type
ImmutableCommandDescriptor.
Initialize attributes and then invoke the build() method to create an
immutable instance.
Builder is not thread-safe and generally should not be stored in a field or collection,
but instead used immediately to create instances.
-
Method Summary
Modifier and TypeMethodDescriptionaddAllSyntax(Iterable<? extends SyntaxFragment> elements) Adds elements tosyntaxlist.addSyntax(SyntaxFragment element) Adds one element tosyntaxlist.addSyntax(SyntaxFragment... elements) Adds elements tosyntaxlist.build()Builds a newImmutableCommandDescriptor.commandToken(@NonNull String commandToken) Initializes the value for thecommandTokenattribute.from(CommandDescriptor instance) Fill a builder with attribute values from the providedorg.incendo.cloud.annotations.descriptor.CommandDescriptorinstance.from(Descriptor instance) Fill a builder with attribute values from the providedorg.incendo.cloud.annotations.descriptor.Descriptorinstance.Initializes the value for themethodattribute.Initializes the value for thenameattribute.requiredSender(@NonNull Class<?> requiredSender) Initializes the value for therequiredSenderattribute.syntax(Iterable<? extends SyntaxFragment> elements) Sets or replaces all elements forsyntaxlist.
-
Method Details
-
from
@CanIgnoreReturnValue public final ImmutableCommandDescriptor.Builder from(CommandDescriptor instance) Fill a builder with attribute values from the providedorg.incendo.cloud.annotations.descriptor.CommandDescriptorinstance.- Parameters:
instance- The instance from which to copy values- Returns:
thisbuilder for use in a chained invocation
-
from
Fill a builder with attribute values from the providedorg.incendo.cloud.annotations.descriptor.Descriptorinstance.- Parameters:
instance- The instance from which to copy values- Returns:
thisbuilder for use in a chained invocation
-
method
@CanIgnoreReturnValue public final ImmutableCommandDescriptor.Builder method(@NonNull Method method) Initializes the value for themethodattribute.- Parameters:
method- The value for method- Returns:
thisbuilder for use in a chained invocation
-
name
Initializes the value for thenameattribute.If not set, this attribute will have a default value as returned by the initializer of
name.- Parameters:
name- The value for name- Returns:
thisbuilder for use in a chained invocation
-
addSyntax
@CanIgnoreReturnValue public final ImmutableCommandDescriptor.Builder addSyntax(SyntaxFragment element) Adds one element tosyntaxlist.- Parameters:
element- A syntax element- Returns:
thisbuilder for use in a chained invocation
-
addSyntax
@CanIgnoreReturnValue public final ImmutableCommandDescriptor.Builder addSyntax(SyntaxFragment... elements) Adds elements tosyntaxlist.- Parameters:
elements- An array of syntax elements- Returns:
thisbuilder for use in a chained invocation
-
syntax
@CanIgnoreReturnValue public final ImmutableCommandDescriptor.Builder syntax(Iterable<? extends SyntaxFragment> elements) Sets or replaces all elements forsyntaxlist.- Parameters:
elements- An iterable of syntax elements- Returns:
thisbuilder for use in a chained invocation
-
addAllSyntax
@CanIgnoreReturnValue public final ImmutableCommandDescriptor.Builder addAllSyntax(Iterable<? extends SyntaxFragment> elements) Adds elements tosyntaxlist.- Parameters:
elements- An iterable of syntax elements- Returns:
thisbuilder for use in a chained invocation
-
commandToken
@CanIgnoreReturnValue public final ImmutableCommandDescriptor.Builder commandToken(@NonNull String commandToken) Initializes the value for thecommandTokenattribute.- Parameters:
commandToken- The value for commandToken- Returns:
thisbuilder for use in a chained invocation
-
requiredSender
@CanIgnoreReturnValue public final ImmutableCommandDescriptor.Builder requiredSender(@NonNull Class<?> requiredSender) Initializes the value for therequiredSenderattribute.- Parameters:
requiredSender- The value for requiredSender- Returns:
thisbuilder for use in a chained invocation
-
build
Builds a newImmutableCommandDescriptor.- Returns:
- An immutable instance of CommandDescriptor
- Throws:
IllegalStateException- if any required attributes are missing
-