Class CompositeCodeTransformer

java.lang.Object
com.google.errorprone.CompositeCodeTransformer
All Implemented Interfaces:
CodeTransformer, Serializable

public abstract class CompositeCodeTransformer extends Object implements CodeTransformer, Serializable
Combines multiple CodeTransformers into one.
See Also:
  • Method Details

    • compose

      public static CodeTransformer compose(CodeTransformer... transformers)
    • compose

      public static CodeTransformer compose(Iterable<? extends CodeTransformer> transformers)
    • transformers

      public abstract com.google.common.collect.ImmutableList<CodeTransformer> transformers()
    • apply

      public void apply(com.sun.source.util.TreePath path, com.sun.tools.javac.util.Context context, DescriptionListener listener)
      Description copied from interface: CodeTransformer
      Apply recursively from the leaf node in the given TreePath.
      Specified by:
      apply in interface CodeTransformer
    • annotations

      public com.google.common.collect.ImmutableClassToInstanceMap<Annotation> annotations()
      Description copied from interface: CodeTransformer
      Returns a map of annotation data logically applied to this code transformer.

      As an example, if a CodeTransformer expressed as a Refaster rule had an annotation applied to it:

      
       @MyCustomAnnotation("value")
       public class AnnotatedRefasterRule {
          @BeforeTemplate void before(String x) {...}
          @AfterTemplate void after(String x) {...}
       }
       
      You could retrieve the value of @MyCustomAnnotation from this map.
      Specified by:
      annotations in interface CodeTransformer