Class ImmutableTrees.IterationGenerator
- java.lang.Object
-
- org.immutables.generator.processor.ImmutableTrees.IterationGenerator
-
- All Implemented Interfaces:
Trees.GeneratorDeclaration,Trees.GeneratorValueDeclaration,Trees.IterationGenerator
- Enclosing class:
- ImmutableTrees
@Immutable public static final class ImmutableTrees.IterationGenerator extends java.lang.Object implements Trees.IterationGenerator
Immutable implementation ofTrees.IterationGenerator.Use the builder to create immutable instances:
ImmutableTrees.IterationGenerator.builder().
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classImmutableTrees.IterationGenerator.BuilderBuilds instances of typeIterationGenerator.
-
Field Summary
Fields Modifier and Type Field Description private com.google.common.base.Optional<Trees.Expression>conditionprivate Trees.ValueDeclarationdeclarationprivate Trees.Expressionfrom
-
Constructor Summary
Constructors Modifier Constructor Description privateIterationGenerator(Trees.ValueDeclaration declaration, Trees.Expression from, com.google.common.base.Optional<Trees.Expression> condition)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ImmutableTrees.IterationGenerator.Builderbuilder()Creates a builder forIterationGenerator.com.google.common.base.Optional<Trees.Expression>condition()static ImmutableTrees.IterationGeneratorcopyOf(Trees.IterationGenerator instance)Creates an immutable copy of aTrees.IterationGeneratorvalue.Trees.ValueDeclarationdeclaration()booleanequals(java.lang.Object another)This instance is equal to all instances ofIterationGeneratorthat have equal attribute values.private booleanequalTo(int synthetic, ImmutableTrees.IterationGenerator another)Trees.Expressionfrom()inthashCode()Computes a hash code from attributes:declaration,from,condition.java.lang.StringtoString()Prints the immutable valueIterationGeneratorwith attribute values.ImmutableTrees.IterationGeneratorwithCondition(com.google.common.base.Optional<? extends Trees.Expression> optional)Copy the current immutable object by setting an optional value for theconditionattribute.ImmutableTrees.IterationGeneratorwithCondition(Trees.Expression value)Copy the current immutable object by setting a present value for the optionalconditionattribute.ImmutableTrees.IterationGeneratorwithDeclaration(Trees.ValueDeclaration value)Copy the current immutable object by setting a value for thedeclarationattribute.ImmutableTrees.IterationGeneratorwithFrom(Trees.Expression value)Copy the current immutable object by setting a value for thefromattribute.
-
-
-
Field Detail
-
declaration
private final Trees.ValueDeclaration declaration
-
from
private final Trees.Expression from
-
condition
private final com.google.common.base.Optional<Trees.Expression> condition
-
-
Constructor Detail
-
IterationGenerator
private IterationGenerator(Trees.ValueDeclaration declaration, Trees.Expression from, com.google.common.base.Optional<Trees.Expression> condition)
-
-
Method Detail
-
declaration
public Trees.ValueDeclaration declaration()
- Specified by:
declarationin interfaceTrees.GeneratorValueDeclaration- Returns:
- The value of the
declarationattribute
-
from
public Trees.Expression from()
- Specified by:
fromin interfaceTrees.GeneratorValueDeclaration- Returns:
- The value of the
fromattribute
-
condition
public com.google.common.base.Optional<Trees.Expression> condition()
- Specified by:
conditionin interfaceTrees.IterationGenerator- Returns:
- The value of the
conditionattribute
-
withDeclaration
public final ImmutableTrees.IterationGenerator withDeclaration(Trees.ValueDeclaration value)
Copy the current immutable object by setting a value for thedeclarationattribute. A shallow reference equality check is used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for declaration- Returns:
- A modified copy of the
thisobject
-
withFrom
public final ImmutableTrees.IterationGenerator withFrom(Trees.Expression value)
Copy the current immutable object by setting a value for thefromattribute. A shallow reference equality check is used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for from- Returns:
- A modified copy of the
thisobject
-
withCondition
public final ImmutableTrees.IterationGenerator withCondition(Trees.Expression value)
Copy the current immutable object by setting a present value for the optionalconditionattribute.- Parameters:
value- The value for condition- Returns:
- A modified copy of
thisobject
-
withCondition
public final ImmutableTrees.IterationGenerator withCondition(com.google.common.base.Optional<? extends Trees.Expression> optional)
Copy the current immutable object by setting an optional value for theconditionattribute. 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 condition- Returns:
- A modified copy of
thisobject
-
equals
public boolean equals(@Nullable java.lang.Object another)This instance is equal to all instances ofIterationGeneratorthat have equal attribute values.- Overrides:
equalsin classjava.lang.Object- Returns:
trueifthisis equal toanotherinstance
-
equalTo
private boolean equalTo(int synthetic, ImmutableTrees.IterationGenerator another)
-
hashCode
public int hashCode()
Computes a hash code from attributes:declaration,from,condition.- Overrides:
hashCodein classjava.lang.Object- Returns:
- hashCode value
-
toString
public java.lang.String toString()
Prints the immutable valueIterationGeneratorwith attribute values.- Overrides:
toStringin classjava.lang.Object- Returns:
- A string representation of the value
-
copyOf
public static ImmutableTrees.IterationGenerator copyOf(Trees.IterationGenerator instance)
Creates an immutable copy of aTrees.IterationGeneratorvalue. 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 IterationGenerator instance
-
builder
public static ImmutableTrees.IterationGenerator.Builder builder()
Creates a builder forIterationGenerator.ImmutableTrees.IterationGenerator.builder() .declaration(org.immutables.generator.processor.Trees.ValueDeclaration) // requireddeclaration.from(org.immutables.generator.processor.Trees.Expression) // requiredfrom.condition(org.immutables.generator.processor.Trees.Expression) // optionalcondition.build();- Returns:
- A new IterationGenerator builder
-
-