Uses of Interface
spoon.reflect.declaration.CtType
Package
Description
This root package provides the default integrated launchers for Spoon program processing.
Ready to go meta?
This package contains classes that model the Spoon metamodel itself.
This package defines the Spoon's compile-time meta-model of Java programs.
This package contains the meta-model part that models the declarations (program's structures such as classes, fields, etc).
This package defines all the sub-factories for the Spoon meta-model.
This package defines the references to program elements for the meta-model.
This package defines visitor, scanner, and scanner-based query API for Java programs reified in the meta-model.
This package contains a set of useful filters when querying the model.
This package contains some default implementations for commonly used processing tasks.
This package provides support for the sniper mode: only the transformed part of classes is rewritten to disk.
This package defines a framework for well-typed pure-Java templates.
-
Uses of CtType in spoon
Modifier and TypeMethodDescriptionvoid
SpoonModelBuilder.generateProcessedSourceFiles(OutputType outputType, Filter<CtType<?>> typeFilter)
Generates the source code associated to the classes stored in this compiler's factory.void
Launcher.setOutputFilter(Filter<CtType<?>> typeFilter)
void
SpoonAPI.setOutputFilter(Filter<CtType<?>> typeFilter)
Applies a filter when the output-type is defined on classes. -
Uses of CtType in spoon.metamodel
Modifier and TypeMethodDescriptionMetamodel.getAllInstantiableMetamodelInterfaces()
Metamodel.getAllMetamodelInterfaces()
Returns all interfaces of the Spoon metamodel. -
Uses of CtType in spoon.pattern
Modifier and TypeMethodDescription<T extends CtType<?>>
TGenerates a type with qualified name `typeQualifiedName` by replacing the generator parameters with the arguments given in `params`.Modifier and TypeMethodDescriptionPatternParameterConfigurator.byLocalType(CtType<?> searchScope, String localTypeSimpleName)
Searches for a type visible in scope `templateType`, whose simple name is equal to `localTypeSimpleName` -
Uses of CtType in spoon.pattern.internal
-
Uses of CtType in spoon.refactoring
Modifier and TypeMethodDescriptionCollection<CtType<?>>
MethodCallState.getCallerFields()
Returns a collection containing all types invoking the method with a field.Modifier and TypeMethodDescriptionvoid
Adds a CtType to the fields invoking this method.static void
Refactoring.changeTypeName(CtType<?> type, String name)
Changes name of a type element.boolean
static CtType<?>
See doc incopyType()
void
-
Uses of CtType in spoon.reflect
Modifier and TypeMethodDescriptionCollection<CtType<?>>
CtModel.getAllTypes()
returns all top-level types of the modelCollection<CtType<?>>
CtModelImpl.getAllTypes()
-
Uses of CtType in spoon.reflect.declaration
Modifier and TypeInterfaceDescriptioninterface
CtAnnotationType<T extends Annotation>
This element defines an annotation type.interface
CtClass<T>
This element represents a class declaration.interface
This element represents an enumeration declaration.interface
CtInterface<T>
This element defines an interface declaration.interface
This element represents a record declaration.interface
This element defines a declaration of a type parameter (aka generics).Modifier and TypeMethodDescriptionadd a field at a given position.add a field at the end of the field list.CtType.addFieldAtTop(CtField<F> field)
Adds a field at the top of the type (before static block).CtTypeParameter.addFieldAtTop(CtField<F> field)
Adds a method to this type.Adds a method to this type.CtType.addNestedType(CtType<N> nestedType)
Add a nested type.CtTypeParameter.addNestedType(CtType<N> nestedType)
CtType.addSuperInterface(CtTypeReference<S> interfac)
CtTypeParameter.addSuperInterface(CtTypeReference<S> interfac)
CtType.addTypeMember(CtTypeMember member)
Adds a type member at the end of all type member of the type.CtType.addTypeMemberAt(int position, CtTypeMember member)
Adds a type member at a given position.<N extends CtType<?>>
NCtType.getNestedType(String name)
Gets a nested type from its name.<T extends CtType<?>>
TFinds a top-level type by name.Sets all fields in the type.CtAnnotationType.setMethods(Set<CtMethod<?>> methods)
Sets the methods of this type.CtType.setMethods(Set<CtMethod<?>> methods)
Sets the methods of this type.CtTypeParameter.setMethods(Set<CtMethod<?>> methods)
CtType.setNestedTypes(Set<CtType<?>> nestedTypes)
Sets all nested types.CtTypeParameter.setNestedTypes(Set<CtType<?>> nestedTypes)
CtAnnotationType.setSuperclass(CtTypeReference<?> superClass)
CtEnum.setSuperclass(CtTypeReference<?> superClass)
CtInterface.setSuperclass(CtTypeReference<?> superClass)
CtRecord.setSuperclass(CtTypeReference<?> superClass)
CtType.setSuperclass(CtTypeReference<?> superClass)
Sets the superclass type.CtAnnotationType.setSuperInterfaces(Set<CtTypeReference<?>> interfaces)
CtType.setSuperInterfaces(Set<CtTypeReference<?>> interfaces)
Sets the super interfaces of this type.CtTypeParameter.setSuperInterfaces(Set<CtTypeReference<?>> interfaces)
CtType.setTypeMembers(List<CtTypeMember> members)
Removes all types members with these new members.CtTypeParameter.setTypeMembers(List<CtTypeMember> members)
Modifier and TypeMethodDescriptionCtType.clone()
CtType<?>
CtType.copyType()
Copy the type, where copy means cloning + porting all the references in the clone from the old type to the new type.CtType<?>
CtTypeMember.getDeclaringType()
Gets the type that declares this class member.CtType<?>
CtCompilationUnit.getMainType()
Searches and returns the main type (the type which has the same name as the file).<T> CtType<T>
CtTypeMember.getTopLevelType()
Returns the top level type declaring this type if an inner type or type member.Modifier and TypeMethodDescriptionCtCompilationUnit.getDeclaredTypes()
Gets all the types declared in this compilation unit.CtType.getNestedTypes()
Returns the declarations of the nested classes and interfaces that are directly declared by this class or interface.CtPackage.getTypes()
Returns the set of the top-level types in this package.Modifier and TypeMethodDescriptionCtCompilationUnit.addDeclaredType(CtType<?> type)
Add a type to the list of declared types.CtType.addNestedType(CtType<N> nestedType)
Add a nested type.CtTypeParameter.addNestedType(CtType<N> nestedType)
<T extends CtPackage>
TAdds a type to this package.<N> boolean
CtType.removeNestedType(CtType<N> nestedType)
Remove a nested type.void
CtPackage.removeType(CtType<?> type)
Removes a type from this package.Modifier and TypeMethodDescriptionCtCompilationUnit.setDeclaredTypes(List<CtType<?>> types)
Sets the types declared in this compilation unit.CtType.setNestedTypes(Set<CtType<?>> nestedTypes)
Sets all nested types.CtTypeParameter.setNestedTypes(Set<CtType<?>> nestedTypes)
<T extends CtPackage>
TSets the types defined in the package. -
Uses of CtType in spoon.reflect.factory
Modifier and TypeMethodDescription<T> CtType<T>
Gets a type from its runtime Java class.<T> CtType<T>
Gets a created type from its qualified name if source in the source classpath.<T extends Annotation>
CtType<T>AnnotationFactory.getAnnotationType(String qualifiedName)
Gets a annotation type from its name.Modifier and TypeMethodDescriptionTypeFactory.getAll()
Gets the list of all top-level created types.TypeFactory.getAll(boolean includeNestedTypes)
Gets the list of all created types.Modifier and TypeMethodDescriptionadd a new type to be pretty-printed<T> CtField<T>
FieldFactory.create(CtType<?> target, Set<ModifierKind> modifiers, CtTypeReference<T> type, String name)
Creates a field.<T> CtField<T>
FieldFactory.create(CtType<?> target, Set<ModifierKind> modifiers, CtTypeReference<T> type, String name, CtExpression<T> defaultExpression)
Creates a field.<T> CtField<T>
Creates a field by copying an existing field.<T> CtInterface<T>
Creates an inner interface<T> CtMethod<T>
MethodFactory.create(CtType<?> target, Set<ModifierKind> modifiers, CtTypeReference<T> returnType, String name, List<CtParameter<?>> parameters, Set<CtTypeReference<? extends Throwable>> thrownTypes)
Creates an empty method.<T> CtMethod<T>
Creates a method by copying an existing method.<T> CtArrayTypeReference<T[]>
Factory.createArrayReference(CtType<T> type)
<T> CtArrayTypeReference<T[]>
FactoryImpl.createArrayReference(CtType<T> type)
<T> CtArrayTypeReference<T[]>
TypeFactory.createArrayReference(CtType<T> type)
Creates a reference to an array of given type.Factory.createField(CtType<?> target, Set<ModifierKind> modifiers, CtTypeReference type, String name)
Factory.createField(CtType<?> target, Set<ModifierKind> modifiers, CtTypeReference type, String name, CtExpression defaultExpression)
Factory.createField(CtType<?> target, CtField source)
FactoryImpl.createField(CtType<?> target, Set<ModifierKind> modifiers, CtTypeReference type, String name)
FactoryImpl.createField(CtType<?> target, Set<ModifierKind> modifiers, CtTypeReference type, String name, CtExpression defaultExpression)
FactoryImpl.createField(CtType<?> target, CtField source)
Factory.createInterface(CtType owner, String simpleName)
FactoryImpl.createInterface(CtType owner, String simpleName)
Factory.createMethod(CtType<?> target, Set<ModifierKind> modifiers, CtTypeReference returnType, String name, List<CtParameter<?>> parameters, Set<CtTypeReference<? extends Throwable>> thrownTypes)
Factory.createMethod(CtType<?> target, CtMethod source, boolean redirectReferences)
FactoryImpl.createMethod(CtType<?> target, Set<ModifierKind> modifiers, CtTypeReference returnType, String name, List<CtParameter<?>> parameters, Set<CtTypeReference<? extends Throwable>> thrownTypes)
FactoryImpl.createMethod(CtType<?> target, CtMethod source, boolean redirectReferences)
<T> CtNewClass<T>
CodeFactory.createNewClass(CtType<T> superClass, CtExpression<?>... parameters)
Creates a new anonymous class.CtNewClass<?>
Factory.createNewClass(CtType<?> superClass, CtExpression<?>... parameters)
Creates an anonymous classCtNewClass<?>
FactoryImpl.createNewClass(CtType<?> superClass, CtExpression<?>... parameters)
<T> CtTypeReference<T>
TypeFactory.createReference(CtType<T> type)
Create a reference to a simple type<T> CtTypeReference<T>
TypeFactory.createReference(CtType<T> type, boolean includingFormalTypeParameter)
CompilationUnitFactory.getOrCreate(CtType type)
Returns the compilation unit corresponding to this type.void
CompilationUnitFactory.removeType(CtType<?> type)
remove a type from the list of types to be pretty-printed -
Uses of CtType in spoon.reflect.reference
Modifier and TypeMethodDescriptionCtType<?>
CtTypeMemberWildcardImportReference.getDeclaration()
CtTypeReference.getDeclaration()
Returns theCtType
, that corresponds to the reference ornull
if the type declaration is not in the analyzed source files,CtTypeReference.getTypeDeclaration()
is a newer and better alternative that less often returns null.CtTypeReference.getTypeDeclaration()
Returns theCtType
that corresponds to the reference even if the type isn't in the Spoon source path (in this case, the Spoon elements are built with runtime reflection, and the resulting CtType is called a "shadow" class, seeCtShadowable.isShadow()
). -
Uses of CtType in spoon.reflect.visitor
Modifier and TypeMethodDescriptionDefaultJavaPrettyPrinter.printTypes(CtType<?>... type)
PrettyPrinter.printTypes(CtType<?>... type)
Prints the types of one compilation unit It always resets the printing context at the beginning of this process.void
PrintingContext.pushCurrentThis(CtType<?> type)
Adds the given type to the stack of types.<T> void
CtInheritanceScanner.scanCtType(CtType<T> type)
Scans an abstract type.void
ElementPrinterHelper.writeExtendsClause(CtType<?> type)
void
ElementPrinterHelper.writeImplementsClause(CtType<?> type)
writes the implemented interfaces with a ListPrinterModifier and TypeMethodDescriptionvoid
DefaultJavaPrettyPrinter.calculate(CtCompilationUnit sourceCompilationUnit, List<CtType<?>> types)
void
PrettyPrinter.calculate(CtCompilationUnit sourceCompilationUnit, List<CtType<?>> types)
Calculates the resulting source file for a list of types. -
Uses of CtType in spoon.reflect.visitor.filter
-
Uses of CtType in spoon.support
Modifier and TypeMethodDescriptionvoid
JavaOutputProcessor.createJavaFile(CtType<?> element)
Creates the Java file associated to the given element.protected Path
DefaultOutputDestinationHandler.getDirectoryPath(CtModule module, CtPackage pack, CtType type)
protected String
DefaultOutputDestinationHandler.getFileName(CtPackage pack, CtType type)
DefaultOutputDestinationHandler.getOutputPath(CtModule module, CtPackage pack, CtType type)
OutputDestinationHandler.getOutputPath(CtModule module, CtPackage pack, CtType type)
-
Uses of CtType in spoon.support.adaption
Modifier and TypeMethodDescriptionAdapts a type from a supertype to the context of this adaptor.static boolean
TypeAdaptor.isSubtype(CtType<?> base, CtTypeReference<?> superRef)
Checks whether the base is a subtype of the passed superref.ModifierConstructorDescriptionTypeAdaptor(CtType<?> hierarchyStart)
Creates a new type adaptor using the given type as the start of its hierarchy. -
Uses of CtType in spoon.support.compiler
Modifier and TypeMethodDescriptionstatic void
SnippetCompilationHelper.compileAndReplaceSnippetsIn(CtType<?> initialClass)
Takes the class given as parameter, pretty-prints it, get the JDT'ast and the corrspondong Spoon AST and finally replace all children of initialClass by the the fresh ones. -
Uses of CtType in spoon.support.compiler.jdt
Modifier and TypeMethodDescriptionvoid
JDTBasedSpoonCompiler.generateProcessedSourceFiles(OutputType outputType, Filter<CtType<?>> typeFilter)
protected void
JDTBasedSpoonCompiler.generateProcessedSourceFilesUsingTypes(Filter<CtType<?>> typeFilter)
-
Uses of CtType in spoon.support.reflect.code
Modifier and TypeMethodDescriptionCtIfImpl.getSubstitution(CtType<?> targetType)
CtLoopImpl.getSubstitution(CtType<?> targetType)
CtReturnImpl.getSubstitution(CtType<?> targetType)
CtStatementListImpl.getSubstitution(CtType<?> targetType)
CtThrowImpl.getSubstitution(CtType<?> targetType)
CtTryImpl.getSubstitution(CtType<?> targetType)
-
Uses of CtType in spoon.support.reflect.declaration
Modifier and TypeClassDescriptionclass
CtAnnotationTypeImpl<T extends Annotation>
The implementation forCtAnnotationType
.class
CtClassImpl<T>
The implementation forCtClass
.class
CtEnumImpl<T extends Enum<?>>
class
class
class
CtTypeImpl<T>
The implementation forCtType
.class
Modifier and TypeMethodDescriptionCtTypeImpl.addFieldAtTop(CtField<F> field)
CtTypeParameterImpl.addFieldAtTop(CtField<F> field)
CtInterfaceImpl.addNestedType(CtType<N> nestedType)
CtTypeImpl.addNestedType(CtType<N> nestedType)
CtTypeParameterImpl.addNestedType(CtType<N> nestedType)
CtTypeImpl.addSuperInterface(CtTypeReference<S> interfac)
CtTypeParameterImpl.addSuperInterface(CtTypeReference<S> interfac)
CtTypeImpl.addTypeMember(CtTypeMember member)
Adds a type member.CtRecordImpl.addTypeMemberAt(int position, CtTypeMember member)
CtTypeImpl.addTypeMemberAt(int position, CtTypeMember member)
<N extends CtType<?>>
NCtTypeImpl.getNestedType(String name)
<N extends CtType<?>>
NCtTypeParameterImpl.getNestedType(String name)
<T extends CtType<?>>
TCtRecordImpl.setMethods(Set<CtMethod<?>> methods)
CtTypeImpl.setMethods(Set<CtMethod<?>> methods)
CtTypeParameterImpl.setMethods(Set<CtMethod<?>> methods)
CtTypeImpl.setNestedTypes(Set<CtType<?>> nestedTypes)
CtTypeParameterImpl.setNestedTypes(Set<CtType<?>> nestedTypes)
CtAnnotationTypeImpl.setSuperclass(CtTypeReference<?> superClass)
CtClassImpl.setSuperclass(CtTypeReference<?> superClass)
CtEnumImpl.setSuperclass(CtTypeReference<?> superClass)
CtInterfaceImpl.setSuperclass(CtTypeReference<?> superClass)
CtRecordImpl.setSuperclass(CtTypeReference<?> superClass)
CtTypeImpl.setSuperclass(CtTypeReference<?> superClass)
CtTypeParameterImpl.setSuperclass(CtTypeReference<?> superClass)
CtAnnotationTypeImpl.setSuperInterfaces(Set<CtTypeReference<?>> interfaces)
CtTypeImpl.setSuperInterfaces(Set<CtTypeReference<?>> interfaces)
CtTypeParameterImpl.setSuperInterfaces(Set<CtTypeReference<?>> interfaces)
CtRecordImpl.setTypeMembers(List<CtTypeMember> members)
CtTypeImpl.setTypeMembers(List<CtTypeMember> members)
CtTypeParameterImpl.setTypeMembers(List<CtTypeMember> members)
Modifier and TypeMethodDescriptionCtTypeImpl.clone()
CtType<?>
CtTypeImpl.copyType()
CtConstructorImpl.getDeclaringType()
CtType<?>
CtExecutableImpl.getDeclaringType()
CtType<?>
CtFieldImpl.getDeclaringType()
CtType<?>
CtTypeImpl.getDeclaringType()
InvisibleArrayConstructorImpl.getDeclaringType()
CtType<?>
CtCompilationUnitImpl.getMainType()
<T> CtType<T>
CtExecutableImpl.getTopLevelType()
<T> CtType<T>
CtFieldImpl.getTopLevelType()
<T> CtType<T>
CtTypeImpl.getTopLevelType()
Modifier and TypeMethodDescriptionCtCompilationUnitImpl.getDeclaredTypes()
CtTypeImpl.getNestedTypes()
CtTypeParameterImpl.getNestedTypes()
CtPackageImpl.getTypes()
Modifier and TypeMethodDescriptionCtCompilationUnitImpl.addDeclaredType(CtType<?> type)
CtInterfaceImpl.addNestedType(CtType<N> nestedType)
CtTypeImpl.addNestedType(CtType<N> nestedType)
CtTypeParameterImpl.addNestedType(CtType<N> nestedType)
<T extends CtPackage>
T<N> boolean
CtInterfaceImpl.removeNestedType(CtType<N> nestedType)
<N> boolean
CtTypeImpl.removeNestedType(CtType<N> nestedType)
<N> boolean
CtTypeParameterImpl.removeNestedType(CtType<N> nestedType)
void
CtPackageImpl.removeType(CtType<?> type)
Modifier and TypeMethodDescriptionCtCompilationUnitImpl.setDeclaredTypes(List<CtType<?>> types)
CtTypeImpl.setNestedTypes(Set<CtType<?>> nestedTypes)
CtTypeParameterImpl.setNestedTypes(Set<CtType<?>> nestedTypes)
<T extends CtPackage>
T -
Uses of CtType in spoon.support.reflect.reference
Modifier and TypeMethodDescriptionCtType<?>
CtTypeMemberWildcardImportReferenceImpl.getDeclaration()
CtTypeReferenceImpl.getDeclaration()
CtTypeParameterReferenceImpl.getTypeDeclaration()
CtTypeReferenceImpl.getTypeDeclaration()
CtWildcardReferenceImpl.getTypeDeclaration()
-
Uses of CtType in spoon.support.sniper
Modifier and TypeMethodDescriptionvoid
SniperJavaPrettyPrinter.calculate(CtCompilationUnit compilationUnit, List<CtType<?>> types)
-
Uses of CtType in spoon.support.visitor
Modifier and TypeMethodDescription<T extends CtType<?>>
voidSubInheritanceHierarchyResolver.forEachSubTypeInPackage(CtConsumer<T> outputConsumer)
Calls `outputConsumer.apply(subType)` for each sub type of the targetSuperTypes that are found in `inputPackage`.Modifier and TypeMethodDescriptionprotected ClassTypingContext
ClassTypingContext.createEnclosingHierarchy(CtType<?> enclosingType)
might be used to create custom chain of super type hierarchies -
Uses of CtType in spoon.support.visitor.clone
Modifier and TypeMethodDescription<T> void
CloneBuilder.scanCtType(CtType<T> type)
Scans an abstract type. -
Uses of CtType in spoon.support.visitor.java
-
Uses of CtType in spoon.support.visitor.java.internal
Modifier and TypeMethodDescriptionvoid
void
void
-
Uses of CtType in spoon.template
Modifier and TypeMethodDescriptionstatic <T extends CtType<?>>
TSubstitution.createTypeFromTemplate(String qualifiedTypeName, CtType<?> templateOfType, Map<String,Object> templateParameters)
Generates a type (class, interface, enum, ...) from the template model `templateOfType` by by substituting all the template parameters by their values.static <T extends CtType<?>>
TSubstitution.substitute(Template<?> template, T templateType)
Substitutes all the template parameters in a given template type and returns the resulting type.Modifier and TypeMethodDescriptionCtBlock<?>
CtType<?>
Returns the code which results from applying the template.static <T extends CtType<?>>
TSubstitution.createTypeFromTemplate(String qualifiedTypeName, CtType<?> templateOfType, Map<String,Object> templateParameters)
Generates a type (class, interface, enum, ...) from the template model `templateOfType` by by substituting all the template parameters by their values.static <T extends Template<?>>
voidInserts all the methods, fields, constructors, initialization blocks (if target is a class), inner types, and super interfaces (exceptTemplate
) from a given template by substituting all the template parameters by their values.static void
Substitution.insertAllConstructors(CtType<?> targetType, Template<?> template)
Inserts all constructors and initialization blocks from a given template by substituting all the template parameters by their values.static void
Substitution.insertAllFields(CtType<?> targetType, Template<?> template)
Inserts all the fields from a given template by substituting all the template parameters by their values.static void
Substitution.insertAllMethods(CtType<?> targetType, Template<?> template)
Inserts all the methods from a given template by substituting all the template parameters by their values.static void
Substitution.insertAllNestedTypes(CtType<?> targetType, Template<?> template)
Inserts all the nested types from a given template by substituting all the template parameters by their values.static void
Substitution.insertAllSuperInterfaces(CtType<?> targetType, Template<?> template)
Inserts all the super interfaces (exceptTemplate
) from a given template by substituting all the template parameters by their values.static <T> CtField<T>
Substitution.insertField(CtType<?> targetType, Template<?> template, CtField<T> sourceField)
Generates a field (and its initialization expression) from a template field by substituting all the template parameters by their values.static <T> CtMethod<T>
Substitution.insertMethod(CtType<?> targetType, Template<?> template, CtMethod<T> sourceMethod)
Generates a method from a template method by substituting all the template parameters by their values.static <E extends CtElement>
ESubstitution.substitute(CtType<?> targetType, Template<?> template, E code)
Substitutes all the template parameters in a random piece of code.static CtExpression<?>
Substitution.substituteFieldDefaultExpression(CtType<?> targetType, Template<?> template, String fieldName)
Gets a default expression from a template field with all the template parameters substituted. -
Uses of CtType in spoon.testing.utils
Modifier and TypeMethodDescriptionstatic <T extends CtType<?>>
TUtility method for testing: creates the model of `packageName` from src/test/java and returns the CtType corresponding to `className`static <T extends CtType<?>>
TUtility method for testing: creates the model of `packageName` and the factory from src/test/java and returns the CtType corresponding to `className`Modifier and TypeMethodDescriptionstatic <T> CtType<T>
ModelUtils.buildClass(Class<T> classToBuild)
static <T> CtType<T>
ModelUtils.buildClass(Class<T> classToBuild, boolean ensureFullclasspath)
Builds and returns the Spoon model of `` classToBuildstatic <T> CtType<T>
ModelUtils.buildClass(Consumer<Launcher> config, Class<T> classToBuild)