Class ImmutableCommandDescriptor.Builder

java.lang.Object
org.incendo.cloud.annotations.descriptor.ImmutableCommandDescriptor.Builder
Enclosing class:
ImmutableCommandDescriptor

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 Details

    • from

      @CanIgnoreReturnValue public final ImmutableCommandDescriptor.Builder from(CommandDescriptor instance)
      Fill a builder with attribute values from the provided org.incendo.cloud.annotations.descriptor.CommandDescriptor instance.
      Parameters:
      instance - The instance from which to copy values
      Returns:
      this builder for use in a chained invocation
    • from

      @CanIgnoreReturnValue public final ImmutableCommandDescriptor.Builder from(Descriptor instance)
      Fill a builder with attribute values from the provided org.incendo.cloud.annotations.descriptor.Descriptor instance.
      Parameters:
      instance - The instance from which to copy values
      Returns:
      this builder for use in a chained invocation
    • method

      @CanIgnoreReturnValue public final ImmutableCommandDescriptor.Builder method(@NonNull Method method)
      Initializes the value for the method attribute.
      Parameters:
      method - The value for method
      Returns:
      this builder for use in a chained invocation
    • name

      @CanIgnoreReturnValue public final ImmutableCommandDescriptor.Builder name(@NonNull String name)
      Initializes the value for the name attribute.

      If not set, this attribute will have a default value as returned by the initializer of name.

      Parameters:
      name - The value for name
      Returns:
      this builder for use in a chained invocation
    • addSyntax

      @CanIgnoreReturnValue public final ImmutableCommandDescriptor.Builder addSyntax(SyntaxFragment element)
      Adds one element to syntax list.
      Parameters:
      element - A syntax element
      Returns:
      this builder for use in a chained invocation
    • addSyntax

      @CanIgnoreReturnValue public final ImmutableCommandDescriptor.Builder addSyntax(SyntaxFragment... elements)
      Adds elements to syntax list.
      Parameters:
      elements - An array of syntax elements
      Returns:
      this builder for use in a chained invocation
    • syntax

      @CanIgnoreReturnValue public final ImmutableCommandDescriptor.Builder syntax(Iterable<? extends SyntaxFragment> elements)
      Sets or replaces all elements for syntax list.
      Parameters:
      elements - An iterable of syntax elements
      Returns:
      this builder for use in a chained invocation
    • addAllSyntax

      @CanIgnoreReturnValue public final ImmutableCommandDescriptor.Builder addAllSyntax(Iterable<? extends SyntaxFragment> elements)
      Adds elements to syntax list.
      Parameters:
      elements - An iterable of syntax elements
      Returns:
      this builder for use in a chained invocation
    • commandToken

      @CanIgnoreReturnValue public final ImmutableCommandDescriptor.Builder commandToken(@NonNull String commandToken)
      Initializes the value for the commandToken attribute.
      Parameters:
      commandToken - The value for commandToken
      Returns:
      this builder for use in a chained invocation
    • requiredSender

      @CanIgnoreReturnValue public final ImmutableCommandDescriptor.Builder requiredSender(@NonNull Class<?> requiredSender)
      Initializes the value for the requiredSender attribute.
      Parameters:
      requiredSender - The value for requiredSender
      Returns:
      this builder for use in a chained invocation
    • build

      Returns:
      An immutable instance of CommandDescriptor
      Throws:
      IllegalStateException - if any required attributes are missing