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().
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final com.google.common.base.Optional<Trees.Block> private final com.google.common.collect.ImmutableList<Trees.ConditionalBlock> private final Trees.ConditionalBlock -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateIfStatement(Trees.ConditionalBlock then, com.google.common.collect.ImmutableList<Trees.ConditionalBlock> otherwiseIf, com.google.common.base.Optional<Trees.Block> otherwise) -
Method Summary
Modifier and TypeMethodDescriptionbuilder()Creates a builder forIfStatement.static ImmutableTrees.IfStatementcopyOf(Trees.IfStatement instance) Creates an immutable copy of aTrees.IfStatementvalue.booleanThis 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> com.google.common.collect.ImmutableList<Trees.ConditionalBlock> then()toString()Prints the immutable valueIfStatementwith attribute values.withOtherwise(com.google.common.base.Optional<? extends Trees.Block> optional) Copy the current immutable object by setting an optional value for theotherwiseattribute.withOtherwise(Trees.Block value) Copy the current immutable object by setting a present value for the optionalotherwiseattribute.withOtherwiseIf(Iterable<? extends Trees.ConditionalBlock> elements) Copy the current immutable object with elements that replace the content ofotherwiseIf.withOtherwiseIf(Trees.ConditionalBlock... elements) Copy the current immutable object with elements that replace the content ofotherwiseIf.withThen(Trees.ConditionalBlock value) Copy the current immutable object by setting a value for thethenattribute.
-
Field Details
-
then
-
otherwiseIf
-
otherwise
-
-
Constructor Details
-
IfStatement
private IfStatement(Trees.ConditionalBlock then, com.google.common.collect.ImmutableList<Trees.ConditionalBlock> otherwiseIf, com.google.common.base.Optional<Trees.Block> otherwise)
-
-
Method Details
-
then
- Specified by:
thenin interfaceTrees.IfStatement- Returns:
- The value of the
thenattribute
-
otherwiseIf
- Specified by:
otherwiseIfin interfaceTrees.IfStatement- Returns:
- The value of the
otherwiseIfattribute
-
otherwise
- Specified by:
otherwisein interfaceTrees.IfStatement- Returns:
- The value of the
otherwiseattribute
-
withThen
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
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(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
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
This instance is equal to all instances ofIfStatementthat have equal attribute values. -
equalTo
-
hashCode
public int hashCode()Computes a hash code from attributes:then,otherwiseIf,otherwise. -
toString
Prints the immutable valueIfStatementwith attribute values. -
copyOf
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
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
-