Class ImmutableTrees.TransformGenerator
- java.lang.Object
-
- org.immutables.generator.processor.ImmutableTrees.TransformGenerator
-
- All Implemented Interfaces:
Trees.GeneratorDeclaration,Trees.GeneratorValueDeclaration,Trees.TransformGenerator
- Enclosing class:
- ImmutableTrees
@Immutable public static final class ImmutableTrees.TransformGenerator extends java.lang.Object implements Trees.TransformGenerator
Immutable implementation ofTrees.TransformGenerator.Use the builder to create immutable instances:
ImmutableTrees.TransformGenerator.builder().
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classImmutableTrees.TransformGenerator.BuilderBuilds instances of typeTransformGenerator.
-
Field Summary
Fields Modifier and Type Field Description private com.google.common.base.Optional<Trees.Expression>conditionprivate Trees.ValueDeclarationdeclarationprivate Trees.Expressionfromprivate Trees.Expressiontransformprivate Trees.ValueDeclarationvarDeclaration
-
Constructor Summary
Constructors Modifier Constructor Description privateTransformGenerator(Trees.ValueDeclaration declaration, Trees.Expression from, Trees.Expression transform, Trees.ValueDeclaration varDeclaration, 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.TransformGenerator.Builderbuilder()Creates a builder forTransformGenerator.com.google.common.base.Optional<Trees.Expression>condition()static ImmutableTrees.TransformGeneratorcopyOf(Trees.TransformGenerator instance)Creates an immutable copy of aTrees.TransformGeneratorvalue.Trees.ValueDeclarationdeclaration()booleanequals(java.lang.Object another)This instance is equal to all instances ofTransformGeneratorthat have equal attribute values.private booleanequalTo(int synthetic, ImmutableTrees.TransformGenerator another)Trees.Expressionfrom()inthashCode()Computes a hash code from attributes:declaration,from,transform,varDeclaration,condition.java.lang.StringtoString()Prints the immutable valueTransformGeneratorwith attribute values.Trees.Expressiontransform()Trees.ValueDeclarationvarDeclaration()ImmutableTrees.TransformGeneratorwithCondition(com.google.common.base.Optional<? extends Trees.Expression> optional)Copy the current immutable object by setting an optional value for theconditionattribute.ImmutableTrees.TransformGeneratorwithCondition(Trees.Expression value)Copy the current immutable object by setting a present value for the optionalconditionattribute.ImmutableTrees.TransformGeneratorwithDeclaration(Trees.ValueDeclaration value)Copy the current immutable object by setting a value for thedeclarationattribute.ImmutableTrees.TransformGeneratorwithFrom(Trees.Expression value)Copy the current immutable object by setting a value for thefromattribute.ImmutableTrees.TransformGeneratorwithTransform(Trees.Expression value)Copy the current immutable object by setting a value for thetransformattribute.ImmutableTrees.TransformGeneratorwithVarDeclaration(Trees.ValueDeclaration value)Copy the current immutable object by setting a value for thevarDeclarationattribute.
-
-
-
Field Detail
-
declaration
private final Trees.ValueDeclaration declaration
-
from
private final Trees.Expression from
-
transform
private final Trees.Expression transform
-
varDeclaration
private final Trees.ValueDeclaration varDeclaration
-
condition
private final com.google.common.base.Optional<Trees.Expression> condition
-
-
Constructor Detail
-
TransformGenerator
private TransformGenerator(Trees.ValueDeclaration declaration, Trees.Expression from, Trees.Expression transform, Trees.ValueDeclaration varDeclaration, 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
-
transform
public Trees.Expression transform()
- Specified by:
transformin interfaceTrees.TransformGenerator- Returns:
- The value of the
transformattribute
-
varDeclaration
public Trees.ValueDeclaration varDeclaration()
- Specified by:
varDeclarationin interfaceTrees.TransformGenerator- Returns:
- The value of the
varDeclarationattribute
-
condition
public com.google.common.base.Optional<Trees.Expression> condition()
- Specified by:
conditionin interfaceTrees.TransformGenerator- Returns:
- The value of the
conditionattribute
-
withDeclaration
public final ImmutableTrees.TransformGenerator 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.TransformGenerator 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
-
withTransform
public final ImmutableTrees.TransformGenerator withTransform(Trees.Expression value)
Copy the current immutable object by setting a value for thetransformattribute. A shallow reference equality check is used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for transform- Returns:
- A modified copy of the
thisobject
-
withVarDeclaration
public final ImmutableTrees.TransformGenerator withVarDeclaration(Trees.ValueDeclaration value)
Copy the current immutable object by setting a value for thevarDeclarationattribute. A shallow reference equality check is used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for varDeclaration- Returns:
- A modified copy of the
thisobject
-
withCondition
public final ImmutableTrees.TransformGenerator 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.TransformGenerator 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 ofTransformGeneratorthat have equal attribute values.- Overrides:
equalsin classjava.lang.Object- Returns:
trueifthisis equal toanotherinstance
-
equalTo
private boolean equalTo(int synthetic, ImmutableTrees.TransformGenerator another)
-
hashCode
public int hashCode()
Computes a hash code from attributes:declaration,from,transform,varDeclaration,condition.- Overrides:
hashCodein classjava.lang.Object- Returns:
- hashCode value
-
toString
public java.lang.String toString()
Prints the immutable valueTransformGeneratorwith attribute values.- Overrides:
toStringin classjava.lang.Object- Returns:
- A string representation of the value
-
copyOf
public static ImmutableTrees.TransformGenerator copyOf(Trees.TransformGenerator instance)
Creates an immutable copy of aTrees.TransformGeneratorvalue. 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 TransformGenerator instance
-
builder
public static ImmutableTrees.TransformGenerator.Builder builder()
Creates a builder forTransformGenerator.ImmutableTrees.TransformGenerator.builder() .declaration(org.immutables.generator.processor.Trees.ValueDeclaration) // requireddeclaration.from(org.immutables.generator.processor.Trees.Expression) // requiredfrom.transform(org.immutables.generator.processor.Trees.Expression) // requiredtransform.varDeclaration(org.immutables.generator.processor.Trees.ValueDeclaration) // requiredvarDeclaration.condition(org.immutables.generator.processor.Trees.Expression) // optionalcondition.build();- Returns:
- A new TransformGenerator builder
-
-