Class ExecutableFactory

java.lang.Object
spoon.reflect.factory.SubFactory
spoon.reflect.factory.ExecutableFactory
Direct Known Subclasses:
ConstructorFactory, MethodFactory

public class ExecutableFactory extends SubFactory
The CtExecutable sub-factory.
  • Constructor Details

    • ExecutableFactory

      public ExecutableFactory(Factory factory)
      Creates a new executable sub-factory.
      Parameters:
      factory - the parent factory
  • Method Details

    • createAnonymous

      public CtAnonymousExecutable createAnonymous(CtClass<?> target, CtBlock<Void> body)
      Creates an anonymous executable (initializer block) in a target class).
    • createParameter

      public <T> CtParameter<T> createParameter(CtExecutable<?> parent, CtTypeReference<T> type, String name)
      Creates a new parameter.
    • createParameterReference

      public <T> CtParameterReference<T> createParameterReference(CtParameter<T> parameter)
      Creates a parameter reference from an existing parameter.
      Type Parameters:
      T - the parameter's type
      Parameters:
      parameter - the parameter
    • createReference

      public <T> CtExecutableReference<T> createReference(CtExecutable<T> e)
      Creates an executable reference from an existing executable.
    • createReference

      public <T> CtExecutableReference<T> createReference(CtTypeReference<?> declaringType, CtTypeReference<T> type, String methodName, CtTypeReference<?>... parameterTypes)
      Creates an executable reference.
      Parameters:
      declaringType - reference to the declaring type
      type - the executable's type
      methodName - simple name
      parameterTypes - list of parameter's types
    • createReference

      public <T> CtExecutableReference<T> createReference(CtTypeReference<?> declaringType, boolean isStatic, CtTypeReference<T> type, String methodName, CtTypeReference<?>... parameterTypes)
      Creates an executable reference.
      Parameters:
      declaringType - reference to the declaring type
      isStatic - if this reference references a static executable
      type - the return type of the executable
      methodName - simple name
      parameterTypes - list of parameter's types
    • createReference

      public <T> CtExecutableReference<T> createReference(CtTypeReference<?> declaringType, boolean isStatic, CtTypeReference<T> type, String methodName, List<CtTypeReference<?>> parameterTypes)
      Creates an executable reference.
      Parameters:
      declaringType - reference to the declaring type
      isStatic - if this reference references a static executable
      type - the return type of the executable
      methodName - simple name
      parameterTypes - list of parameter's types
    • createReference

      public <T> CtExecutableReference<T> createReference(CtTypeReference<?> declaringType, CtTypeReference<T> type, String methodName, List<CtTypeReference<?>> parameterTypes)
      Creates an executable reference.
      Parameters:
      declaringType - reference to the declaring type
      type - the return type of the executable
      methodName - simple name
      parameterTypes - list of parameter's types
    • createReference

      public <T> CtExecutableReference<T> createReference(String signature)
      Creates an executable reference from its signature, as defined by the executable reference's toString.