Class ImmutableTrees.IfStatement

java.lang.Object
org.immutables.generator.processor.ImmutableTrees.IfStatement
All Implemented Interfaces:
Trees.IfStatement, Trees.Synthetic, Trees.TemplatePart
Enclosing class:
ImmutableTrees

@Immutable public static final class ImmutableTrees.IfStatement extends Object implements Trees.IfStatement
Immutable implementation of Trees.IfStatement.

Use the builder to create immutable instances: ImmutableTrees.IfStatement.builder().

  • Field Details

  • Constructor Details

  • Method Details

    • then

      public Trees.ConditionalBlock then()
      Specified by:
      then in interface Trees.IfStatement
      Returns:
      The value of the then attribute
    • otherwiseIf

      public com.google.common.collect.ImmutableList<Trees.ConditionalBlock> otherwiseIf()
      Specified by:
      otherwiseIf in interface Trees.IfStatement
      Returns:
      The value of the otherwiseIf attribute
    • otherwise

      public com.google.common.base.Optional<Trees.Block> otherwise()
      Specified by:
      otherwise in interface Trees.IfStatement
      Returns:
      The value of the otherwise attribute
    • withThen

      public final ImmutableTrees.IfStatement withThen(Trees.ConditionalBlock value)
      Copy the current immutable object by setting a value for the then attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for then
      Returns:
      A modified copy of the this object
    • withOtherwiseIf

      public final ImmutableTrees.IfStatement withOtherwiseIf(Trees.ConditionalBlock... elements)
      Copy the current immutable object with elements that replace the content of otherwiseIf.
      Parameters:
      elements - The elements to set
      Returns:
      A modified copy of this object
    • withOtherwiseIf

      public final ImmutableTrees.IfStatement withOtherwiseIf(Iterable<? extends Trees.ConditionalBlock> elements)
      Copy the current immutable object with elements that replace the content of otherwiseIf. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      elements - An iterable of otherwiseIf elements to set
      Returns:
      A modified copy of this object
    • withOtherwise

      public final ImmutableTrees.IfStatement withOtherwise(Trees.Block value)
      Copy the current immutable object by setting a present value for the optional otherwise attribute.
      Parameters:
      value - The value for otherwise
      Returns:
      A modified copy of this object
    • withOtherwise

      public final ImmutableTrees.IfStatement withOtherwise(com.google.common.base.Optional<? extends Trees.Block> optional)
      Copy the current immutable object by setting an optional value for the otherwise attribute. A shallow reference equality check on the optional value is used to prevent copying of the same value by returning this.
      Parameters:
      optional - A value for otherwise
      Returns:
      A modified copy of this object
    • equals

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

      private boolean equalTo(int synthetic, ImmutableTrees.IfStatement another)
    • hashCode

      public int hashCode()
      Computes a hash code from attributes: then, otherwiseIf, otherwise.
      Overrides:
      hashCode in class Object
      Returns:
      hashCode value
    • toString

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

      public static ImmutableTrees.IfStatement copyOf(Trees.IfStatement instance)
      Creates an immutable copy of a Trees.IfStatement 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 IfStatement instance
    • builder

      public static ImmutableTrees.IfStatement.Builder builder()
      Creates a builder for IfStatement.
       ImmutableTrees.IfStatement.builder()
          .then(org.immutables.generator.processor.Trees.ConditionalBlock) // required then
          .addOtherwiseIf|addAllOtherwiseIf(org.immutables.generator.processor.Trees.ConditionalBlock) // otherwiseIf elements
          .otherwise(org.immutables.generator.processor.Trees.Block) // optional otherwise
          .build();
       
      Returns:
      A new IfStatement builder