Class ImmutableItems.Builder

java.lang.Object
io.dialob.api.rest.ImmutableItems.Builder
Enclosing class:
ImmutableItems

@NotThreadSafe public static final class ImmutableItems.Builder extends Object
Builds instances of type ImmutableItems. 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

      public final ImmutableItems.Builder from(Items instance)
      Fill a builder with attribute values from the provided Items instance. Regular attribute values will be replaced with those from the given instance. Absent optional values will not replace present values. Collection elements and entries will be added, not replaced.
      Parameters:
      instance - The instance from which to copy values
      Returns:
      this builder for use in a chained invocation
    • activeItem

      public final ImmutableItems.Builder activeItem(String activeItem)
      Initializes the value for the activeItem attribute.
      Parameters:
      activeItem - The value for activeItem
      Returns:
      this builder for use in a chained invocation
    • addItems

      public final ImmutableItems.Builder addItems(String element)
      Adds one element to items list.
      Parameters:
      element - A items element
      Returns:
      this builder for use in a chained invocation
    • addItems

      public final ImmutableItems.Builder addItems(String... elements)
      Adds elements to items list.
      Parameters:
      elements - An array of items elements
      Returns:
      this builder for use in a chained invocation
    • items

      public final ImmutableItems.Builder items(Iterable<String> elements)
      Sets or replaces all elements for items list.
      Parameters:
      elements - An iterable of items elements
      Returns:
      this builder for use in a chained invocation
    • addAllItems

      public final ImmutableItems.Builder addAllItems(Iterable<String> elements)
      Adds elements to items list.
      Parameters:
      elements - An iterable of items elements
      Returns:
      this builder for use in a chained invocation
    • addAvailableItems

      public final ImmutableItems.Builder addAvailableItems(String element)
      Adds one element to availableItems list.
      Parameters:
      element - A availableItems element
      Returns:
      this builder for use in a chained invocation
    • addAvailableItems

      public final ImmutableItems.Builder addAvailableItems(String... elements)
      Adds elements to availableItems list.
      Parameters:
      elements - An array of availableItems elements
      Returns:
      this builder for use in a chained invocation
    • availableItems

      public final ImmutableItems.Builder availableItems(Iterable<String> elements)
      Sets or replaces all elements for availableItems list.
      Parameters:
      elements - An iterable of availableItems elements
      Returns:
      this builder for use in a chained invocation
    • addAllAvailableItems

      public final ImmutableItems.Builder addAllAvailableItems(Iterable<String> elements)
      Adds elements to availableItems list.
      Parameters:
      elements - An iterable of availableItems elements
      Returns:
      this builder for use in a chained invocation
    • build

      public ImmutableItems build()
      Builds a new ImmutableItems.
      Returns:
      An immutable instance of Items
      Throws:
      IllegalStateException - if any required attributes are missing