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 Object
implements Trees.TransformGenerator
Immutable implementation of
Trees.TransformGenerator.
Use the builder to create immutable instances:
ImmutableTrees.TransformGenerator.builder().
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final com.google.common.base.Optional<Trees.Expression> private final Trees.ValueDeclarationprivate final Trees.Expressionprivate final Trees.Expressionprivate final Trees.ValueDeclaration -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateTransformGenerator(Trees.ValueDeclaration declaration, Trees.Expression from, Trees.Expression transform, Trees.ValueDeclaration varDeclaration, com.google.common.base.Optional<Trees.Expression> condition) -
Method Summary
Modifier and TypeMethodDescriptionbuilder()Creates a builder forTransformGenerator.com.google.common.base.Optional<Trees.Expression> copyOf(Trees.TransformGenerator instance) Creates an immutable copy of aTrees.TransformGeneratorvalue.booleanThis instance is equal to all instances ofTransformGeneratorthat have equal attribute values.private booleanequalTo(int synthetic, ImmutableTrees.TransformGenerator another) from()inthashCode()Computes a hash code from attributes:declaration,from,transform,varDeclaration,condition.toString()Prints the immutable valueTransformGeneratorwith attribute values.withCondition(com.google.common.base.Optional<? extends Trees.Expression> optional) Copy the current immutable object by setting an optional value for theconditionattribute.withCondition(Trees.Expression value) Copy the current immutable object by setting a present value for the optionalconditionattribute.Copy the current immutable object by setting a value for thedeclarationattribute.withFrom(Trees.Expression value) Copy the current immutable object by setting a value for thefromattribute.withTransform(Trees.Expression value) Copy the current immutable object by setting a value for thetransformattribute.Copy the current immutable object by setting a value for thevarDeclarationattribute.
-
Field Details
-
declaration
-
from
-
transform
-
varDeclaration
-
condition
-
-
Constructor Details
-
TransformGenerator
private TransformGenerator(Trees.ValueDeclaration declaration, Trees.Expression from, Trees.Expression transform, Trees.ValueDeclaration varDeclaration, com.google.common.base.Optional<Trees.Expression> condition)
-
-
Method Details
-
declaration
- Specified by:
declarationin interfaceTrees.GeneratorValueDeclaration- Returns:
- The value of the
declarationattribute
-
from
- Specified by:
fromin interfaceTrees.GeneratorValueDeclaration- Returns:
- The value of the
fromattribute
-
transform
- Specified by:
transformin interfaceTrees.TransformGenerator- Returns:
- The value of the
transformattribute
-
varDeclaration
- Specified by:
varDeclarationin interfaceTrees.TransformGenerator- Returns:
- The value of the
varDeclarationattribute
-
condition
- Specified by:
conditionin interfaceTrees.TransformGenerator- Returns:
- The value of the
conditionattribute
-
withDeclaration
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
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
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
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
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
This instance is equal to all instances ofTransformGeneratorthat have equal attribute values. -
equalTo
-
hashCode
public int hashCode()Computes a hash code from attributes:declaration,from,transform,varDeclaration,condition. -
toString
Prints the immutable valueTransformGeneratorwith attribute values. -
copyOf
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
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
-