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 java.lang.Object implements Trees.IfStatement
Immutable implementation ofTrees.IfStatement.Use the builder to create immutable instances:
ImmutableTrees.IfStatement.builder().
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classImmutableTrees.IfStatement.BuilderBuilds instances of typeIfStatement.
-
Field Summary
Fields Modifier and Type Field Description private com.google.common.base.Optional<Trees.Block>otherwiseprivate com.google.common.collect.ImmutableList<Trees.ConditionalBlock>otherwiseIfprivate Trees.ConditionalBlockthen
-
Constructor Summary
Constructors Modifier Constructor Description privateIfStatement(Trees.ConditionalBlock then, com.google.common.collect.ImmutableList<Trees.ConditionalBlock> otherwiseIf, com.google.common.base.Optional<Trees.Block> otherwise)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ImmutableTrees.IfStatement.Builderbuilder()Creates a builder forIfStatement.static ImmutableTrees.IfStatementcopyOf(Trees.IfStatement instance)Creates an immutable copy of aTrees.IfStatementvalue.booleanequals(java.lang.Object another)This instance is equal to all instances ofIfStatementthat have equal attribute values.private booleanequalTo(int synthetic, ImmutableTrees.IfStatement another)inthashCode()Computes a hash code from attributes:then,otherwiseIf,otherwise.com.google.common.base.Optional<Trees.Block>otherwise()com.google.common.collect.ImmutableList<Trees.ConditionalBlock>otherwiseIf()Trees.ConditionalBlockthen()java.lang.StringtoString()Prints the immutable valueIfStatementwith attribute values.ImmutableTrees.IfStatementwithOtherwise(com.google.common.base.Optional<? extends Trees.Block> optional)Copy the current immutable object by setting an optional value for theotherwiseattribute.ImmutableTrees.IfStatementwithOtherwise(Trees.Block value)Copy the current immutable object by setting a present value for the optionalotherwiseattribute.ImmutableTrees.IfStatementwithOtherwiseIf(java.lang.Iterable<? extends Trees.ConditionalBlock> elements)Copy the current immutable object with elements that replace the content ofotherwiseIf.ImmutableTrees.IfStatementwithOtherwiseIf(Trees.ConditionalBlock... elements)Copy the current immutable object with elements that replace the content ofotherwiseIf.ImmutableTrees.IfStatementwithThen(Trees.ConditionalBlock value)Copy the current immutable object by setting a value for thethenattribute.
-
-
-
Field Detail
-
then
private final Trees.ConditionalBlock then
-
otherwiseIf
private final com.google.common.collect.ImmutableList<Trees.ConditionalBlock> otherwiseIf
-
otherwise
private final com.google.common.base.Optional<Trees.Block> otherwise
-
-
Constructor Detail
-
IfStatement
private IfStatement(Trees.ConditionalBlock then, com.google.common.collect.ImmutableList<Trees.ConditionalBlock> otherwiseIf, com.google.common.base.Optional<Trees.Block> otherwise)
-
-
Method Detail
-
then
public Trees.ConditionalBlock then()
- Specified by:
thenin interfaceTrees.IfStatement- Returns:
- The value of the
thenattribute
-
otherwiseIf
public com.google.common.collect.ImmutableList<Trees.ConditionalBlock> otherwiseIf()
- Specified by:
otherwiseIfin interfaceTrees.IfStatement- Returns:
- The value of the
otherwiseIfattribute
-
otherwise
public com.google.common.base.Optional<Trees.Block> otherwise()
- Specified by:
otherwisein interfaceTrees.IfStatement- Returns:
- The value of the
otherwiseattribute
-
withThen
public final ImmutableTrees.IfStatement withThen(Trees.ConditionalBlock value)
Copy the current immutable object by setting a value for thethenattribute. A shallow reference equality check is used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for then- Returns:
- A modified copy of the
thisobject
-
withOtherwiseIf
public final ImmutableTrees.IfStatement withOtherwiseIf(Trees.ConditionalBlock... elements)
Copy the current immutable object with elements that replace the content ofotherwiseIf.- Parameters:
elements- The elements to set- Returns:
- A modified copy of
thisobject
-
withOtherwiseIf
public final ImmutableTrees.IfStatement withOtherwiseIf(java.lang.Iterable<? extends Trees.ConditionalBlock> elements)
Copy the current immutable object with elements that replace the content ofotherwiseIf. A shallow reference equality check is used to prevent copying of the same value by returningthis.- Parameters:
elements- An iterable of otherwiseIf elements to set- Returns:
- A modified copy of
thisobject
-
withOtherwise
public final ImmutableTrees.IfStatement withOtherwise(Trees.Block value)
Copy the current immutable object by setting a present value for the optionalotherwiseattribute.- Parameters:
value- The value for otherwise- Returns:
- A modified copy of
thisobject
-
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 theotherwiseattribute. A shallow reference equality check on the optional value is used to prevent copying of the same value by returningthis.- Parameters:
optional- A value for otherwise- Returns:
- A modified copy of
thisobject
-
equals
public boolean equals(@Nullable java.lang.Object another)This instance is equal to all instances ofIfStatementthat have equal attribute values.- Overrides:
equalsin classjava.lang.Object- Returns:
trueifthisis equal toanotherinstance
-
equalTo
private boolean equalTo(int synthetic, ImmutableTrees.IfStatement another)
-
hashCode
public int hashCode()
Computes a hash code from attributes:then,otherwiseIf,otherwise.- Overrides:
hashCodein classjava.lang.Object- Returns:
- hashCode value
-
toString
public java.lang.String toString()
Prints the immutable valueIfStatementwith attribute values.- Overrides:
toStringin classjava.lang.Object- Returns:
- A string representation of the value
-
copyOf
public static ImmutableTrees.IfStatement copyOf(Trees.IfStatement instance)
Creates an immutable copy of aTrees.IfStatementvalue. 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 forIfStatement.ImmutableTrees.IfStatement.builder() .then(org.immutables.generator.processor.Trees.ConditionalBlock) // requiredthen.addOtherwiseIf|addAllOtherwiseIf(org.immutables.generator.processor.Trees.ConditionalBlock) //otherwiseIfelements .otherwise(org.immutables.generator.processor.Trees.Block) // optionalotherwise.build();- Returns:
- A new IfStatement builder
-
-