org.codehaus.groovy.transform.trait

## Class TraitComposer

- java.lang.Object
- - org.codehaus.groovy.transform.trait.TraitComposer

    public abstract class TraitComposer
    extends java.lang.Object

This class contains a static utility method `doExtendTraits(org.codehaus.groovy.ast.ClassNode, org.codehaus.groovy.control.SourceUnit, org.codehaus.groovy.control.CompilationUnit)` aimed at generating code for a classnode implementing a trait.

Since:
  2.3.0
Author:
  Cédric Champeau

### Field Summary

Fields
`static ClassNode` `COMPILESTATIC_CLASSNODE`

### Constructor Summary

Constructors
Constructor and Description
`TraitComposer()`

### Method Summary

All Methods Static Methods Concrete Methods
`static void` `doExtendTraits(ClassNode cNode, SourceUnit unit, CompilationUnit cu)` Given a class node, if this class node implements a trait, then generate all the appropriate code which delegates calls to the trait.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### COMPILESTATIC_CLASSNODE

    public static final ClassNode COMPILESTATIC_CLASSNODE

### Constructor Detail

#### TraitComposer

    public TraitComposer()

### Method Detail

#### doExtendTraits

    public static void doExtendTraits(ClassNode cNode,
                                      SourceUnit unit,
                                      CompilationUnit cu)

Given a class node, if this class node implements a trait, then generate all the appropriate code which delegates calls to the trait. It is safe to call this method on a class node which does not implement a trait.

Parameters:
  `cNode` - a class node
  `unit` - the source unit