Class ImmutableProgram.Builder

  • Enclosing class:
    ImmutableProgram

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

      • from

        @CanIgnoreReturnValue
        public final ImmutableProgram.Builder from​(Program instance)
        Fill a builder with attribute values from the provided Program 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
      • id

        @CanIgnoreReturnValue
        public final ImmutableProgram.Builder id​(String id)
        Initializes the value for the id attribute.
        Parameters:
        id - The value for id
        Returns:
        this builder for use in a chained invocation
      • rootItem

        @CanIgnoreReturnValue
        public final ImmutableProgram.Builder rootItem​(Item rootItem)
        Initializes the value for the rootItem attribute.
        Parameters:
        rootItem - The value for rootItem
        Returns:
        this builder for use in a chained invocation
      • addItems

        @CanIgnoreReturnValue
        public final ImmutableProgram.Builder addItems​(Item element)
        Adds one element to items list.
        Parameters:
        element - A items element
        Returns:
        this builder for use in a chained invocation
      • addItems

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

        @CanIgnoreReturnValue
        public final ImmutableProgram.Builder items​(Iterable<? extends Item> 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

        @CanIgnoreReturnValue
        public final ImmutableProgram.Builder addAllItems​(Iterable<? extends Item> elements)
        Adds elements to items list.
        Parameters:
        elements - An iterable of items elements
        Returns:
        this builder for use in a chained invocation
      • addValueSets

        @CanIgnoreReturnValue
        public final ImmutableProgram.Builder addValueSets​(ValueSet element)
        Adds one element to valueSets list.
        Parameters:
        element - A valueSets element
        Returns:
        this builder for use in a chained invocation
      • addValueSets

        @CanIgnoreReturnValue
        public final ImmutableProgram.Builder addValueSets​(ValueSet... elements)
        Adds elements to valueSets list.
        Parameters:
        elements - An array of valueSets elements
        Returns:
        this builder for use in a chained invocation
      • valueSets

        @CanIgnoreReturnValue
        public final ImmutableProgram.Builder valueSets​(Iterable<? extends ValueSet> elements)
        Sets or replaces all elements for valueSets list.
        Parameters:
        elements - An iterable of valueSets elements
        Returns:
        this builder for use in a chained invocation
      • addAllValueSets

        @CanIgnoreReturnValue
        public final ImmutableProgram.Builder addAllValueSets​(Iterable<? extends ValueSet> elements)
        Adds elements to valueSets list.
        Parameters:
        elements - An iterable of valueSets elements
        Returns:
        this builder for use in a chained invocation