Class ImmutableProgram

  • All Implemented Interfaces:
    Program, ProgramNode, Serializable

    @ParametersAreNonnullByDefault
    @Generated("org.immutables.processor.ProxyProcessor")
    @Immutable
    @CheckReturnValue
    public final class ImmutableProgram
    extends Object
    implements Program
    Immutable implementation of Program.

    Use the builder to create immutable instances: ImmutableProgram.builder().

    See Also:
    Serialized Form
    • Method Detail

      • getId

        public String getId()
        Specified by:
        getId in interface Program
        Returns:
        The value of the id attribute
      • getRootItem

        public Item getRootItem()
        Specified by:
        getRootItem in interface Program
        Returns:
        The value of the rootItem attribute
      • getItems

        public com.google.common.collect.ImmutableList<Item> getItems()
        Specified by:
        getItems in interface Program
        Returns:
        The value of the items attribute
      • getValueSets

        public com.google.common.collect.ImmutableList<ValueSet> getValueSets()
        Specified by:
        getValueSets in interface Program
        Returns:
        The value of the valueSets attribute
      • withId

        public final ImmutableProgram withId​(String value)
        Copy the current immutable object by setting a value for the id attribute. An equals check used to prevent copying of the same value by returning this.
        Parameters:
        value - A new value for id
        Returns:
        A modified copy of the this object
      • withRootItem

        public final ImmutableProgram withRootItem​(Item value)
        Copy the current immutable object by setting a value for the rootItem attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
        Parameters:
        value - A new value for rootItem
        Returns:
        A modified copy of the this object
      • withItems

        public final ImmutableProgram withItems​(Item... elements)
        Copy the current immutable object with elements that replace the content of items.
        Parameters:
        elements - The elements to set
        Returns:
        A modified copy of this object
      • withItems

        public final ImmutableProgram withItems​(Iterable<? extends Item> elements)
        Copy the current immutable object with elements that replace the content of items. A shallow reference equality check is used to prevent copying of the same value by returning this.
        Parameters:
        elements - An iterable of items elements to set
        Returns:
        A modified copy of this object
      • withValueSets

        public final ImmutableProgram withValueSets​(ValueSet... elements)
        Copy the current immutable object with elements that replace the content of valueSets.
        Parameters:
        elements - The elements to set
        Returns:
        A modified copy of this object
      • withValueSets

        public final ImmutableProgram withValueSets​(Iterable<? extends ValueSet> elements)
        Copy the current immutable object with elements that replace the content of valueSets. A shallow reference equality check is used to prevent copying of the same value by returning this.
        Parameters:
        elements - An iterable of valueSets elements to set
        Returns:
        A modified copy of this object
      • equals

        public boolean equals​(@Nullable
                              Object another)
        This instance is equal to all instances of ImmutableProgram that have equal attribute values.
        Overrides:
        equals in class Object
        Returns:
        true if this is equal to another instance
      • hashCode

        public int hashCode()
        Computes a hash code from attributes: id, rootItem, items, valueSets.
        Overrides:
        hashCode in class Object
        Returns:
        hashCode value
      • toString

        public String toString()
        Prints the immutable value Program with attribute values.
        Overrides:
        toString in class Object
        Returns:
        A string representation of the value
      • copyOf

        public static ImmutableProgram copyOf​(Program instance)
        Creates an immutable copy of a Program value. 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 Program instance
      • builder

        public static ImmutableProgram.Builder builder()
        Creates a builder for ImmutableProgram.
         ImmutableProgram.builder()
            .id(String) // required id
            .rootItem(io.dialob.program.model.Item) // required rootItem
            .addItems|addAllItems(io.dialob.program.model.Item) // items elements
            .addValueSets|addAllValueSets(io.dialob.program.model.ValueSet) // valueSets elements
            .build();
         
        Returns:
        A new ImmutableProgram builder