Class JavaReflectionTreeBuilder


public class JavaReflectionTreeBuilder extends Object
Builds Spoon model from class file using the reflection api. The Spoon model contains only the declaration part (type, field, method, etc.). Everything that isn't available with the reflection api is absent from the model. Those models are available when CtTypeReference.getTypeDeclaration(), CtExecutableReference.getExecutableDeclaration() and CtFieldReference.getFieldDeclaration() are called. To know when an element comes from the reflection api, use CtShadowable.isShadow().
  • Constructor Details

    • JavaReflectionTreeBuilder

      public JavaReflectionTreeBuilder(Factory factory)
  • Method Details

    • scan

      public <T,​ R extends CtType<T>> R scan(Class<T> clazz)
      transforms a java.lang.Class into a CtType (ie a shadow type in Spoon's parlance)
    • visitPackage

      public void visitPackage(Package aPackage)
    • visitClass

      public <T> void visitClass(Class<T> clazz)
    • visitInterface

      public <T> void visitInterface(Class<T> clazz)
    • visitEnum

      public <T> void visitEnum(Class<T> clazz)
    • visitAnnotationClass

      public <T extends Annotation> void visitAnnotationClass(Class<T> clazz)
    • visitAnnotation

      public void visitAnnotation(Annotation annotation)
    • visitConstructor

      public <T> void visitConstructor(Constructor<T> constructor)
    • visitMethod

      public void visitMethod(RtMethod method, Annotation parent)
    • visitField

      public void visitField(Field field)
    • visitEnumValue

      public void visitEnumValue(Field field)
    • visitParameter

      public void visitParameter(RtParameter parameter)
    • visitTypeParameter

      public <T extends GenericDeclaration> void visitTypeParameter(TypeVariable<T> parameter)
    • visitTypeParameterReference

      public <T extends GenericDeclaration> void visitTypeParameterReference(CtRole role, TypeVariable<T> parameter)
    • visitTypeReference

      public void visitTypeReference(CtRole role, ParameterizedType type)
    • visitTypeReference

      public void visitTypeReference(CtRole role, WildcardType type)
    • visitArrayReference

      public <T> void visitArrayReference(CtRole role, Type typeArray)
    • visitTypeReference

      public <T> void visitTypeReference(CtRole role, Class<T> clazz)
    • visitRecord

      public <T> void visitRecord(Class<T> clazz)
    • visitRecordComponent

      public void visitRecordComponent(AnnotatedElement recordComponent)
    • visitType

      protected final <T> void visitType(Class<T> aClass)
    • visitMethod

      public final void visitMethod(RtMethod method)
    • visitTypeReference

      public final void visitTypeReference(CtRole role, Type type)