@GroovyASTTransformation(phase = CompilePhase.CANONICALIZATION)
public class TupleConstructorASTTransformation
extends AbstractASTTransformation
implements CompilationUnitAware, TransformWithPriority
Handles generation of code for the
| Modifiers | Name | Description |
|---|---|---|
record |
TupleConstructorASTTransformation.SelectedTupleProperties |
Result of selectTupleProperties: the super-class properties and self properties that pass the annotation's filters (includes / excludes / allNames / includeProperties / includeFields / includeSuperProperties / includeSuperFields / allProperties). |
| Fields inherited from class | Fields |
|---|---|
class AbstractASTTransformation |
RETENTION_CLASSNODE, sourceUnit |
| Type Params | Return Type | Name and description |
|---|---|---|
|
public static void |
addSpecialMapConstructors(int modifiers, ClassNode cNode, String message, boolean addNoArg)Adds a generated constructor that takes a LinkedHashMap named __namedArgs. |
|
public String |
getAnnotationName() |
|
public int |
priority() |
|
public static TupleConstructorASTTransformation.SelectedTupleProperties |
selectTupleProperties(AbstractASTTransformation xform, ClassNode cNode, AnnotationNode anno)Resolves the property nodes the @TupleConstructor runtime
transform would use as constructor parameters. |
|
public void |
setCompilationUnit(CompilationUnit unit) |
|
public void |
visit(ASTNode[] nodes, SourceUnit source) |
Adds a generated constructor that takes a LinkedHashMap
named __namedArgs. A null map throws
IllegalArgumentException with message from that
constructor. Otherwise each instance property whose name is a key of
the map is assigned from that entry, and the keys are checked
against the property names. When addNoArg is true, a no-arg
constructor that calls this(new LinkedHashMap()) is added
as well.
modifiers - access flags of the generated constructorscNode - class that receives the constructorsmessage - exception text used when the map is nulladdNoArg - whether to also add the no-arg constructor Resolves the property nodes the @TupleConstructor runtime
transform would use as constructor parameters. Honours
includes, excludes, allNames,
includeProperties, includeFields,
includeSuperProperties, includeSuperFields, and
allProperties attributes the same way the full transform does
so the joint-compilation stubber stays in lockstep.