Package spoon.support
Class DefaultCoreFactory
java.lang.Object
spoon.reflect.factory.SubFactory
spoon.support.DefaultCoreFactory
- All Implemented Interfaces:
CoreFactory
This class implements a default core factory for Spoon's meta-model. This
implementation is done with regular Java classes (POJOs).
-
Field Summary
Fields inherited from class spoon.reflect.factory.SubFactory
factory
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescription<T extends CtElement>
Tclone(T object)
Recursively clones a given element of the metamodel and all its child elements.Creates an instance of the concrete metamodel class given as parameter.<A extends Annotation>
CtAnnotation<A>Creates an annotation.<T> CtAnnotationFieldAccess<T>
Create an access to annotation value<T> CtAnnotationMethod<T>
Creates an annotation method.<T extends Annotation>
CtAnnotationType<T>Creates an annotation type.Creates an anonymous executable.<T> CtArrayRead<T>
Creates an array read access expression.<T> CtArrayTypeReference<T>
Creates an array type reference.<T> CtArrayWrite<T>
Creates an array write access expression.<T> CtAssert<T>
Creates anassert
statement.<T, A extends T>
CtAssignment<T,A>Creates an assignment expression.<T> CtBinaryOperator<T>
Creates a binary operator.<R> CtBlock<R>
Creates a block.createBodyHolderSourcePosition(CompilationUnit compilationUnit, int nameStart, int nameEnd, int modifierStart, int modifierEnd, int declarationStart, int declarationEnd, int bodyStart, int bodyEnd, int[] lineSeparatorPositions)
Creates a body holder source position.Creates abreak
statement.<S> CtCase<S>
Creates acase
clause.Creates acatch
clause.<T> CtCatchVariable<T>
Creates a catch variable declaration statement.<T> CtCatchVariableReference<T>
Creates a catch variable reference.<T> CtClass<T>
Creates a class.<T> CtCodeSnippetExpression<T>
Creates a code snippet expression.Creates a code snippet statement.Creates a comment.Creates a compilation unit.createCompoundSourcePosition(CompilationUnit compilationUnit, int startSource, int end, int declarationStart, int declarationEnd, int[] lineSeparatorPositions)
Creates a compound source position.<T> CtConditional<T>
Creates a conditional expression (boolExpr?ifTrue:ifFalse
).<T> CtConstructor<T>
Creates a constructor.<T> CtConstructorCall<T>
Creates a constructor call expression.Creates acontinue
statement.createDeclarationSourcePosition(CompilationUnit compilationUnit, int startSource, int end, int modifierStart, int modifierEnd, int declarationStart, int declarationEnd, int[] lineSeparatorPositions)
Creates a declaration source position.createDo()
Creates ado
loop.Creates an enum.<T> CtEnumValue<T>
Creates an enum value.<T> CtExecutableReference<T>
Creates an executable reference.<T, E extends CtExpression<?>>
CtExecutableReferenceExpression<T,E>Creates a new executable reference expression.<T> CtField<T>
Creates a field.<T> CtFieldRead<T>
Creates a field read access.<T> CtFieldReference<T>
Creates a field reference.<T> CtFieldWrite<T>
Creates a field write access.Creates afor
loop.Creates aforeach
loop.createIf()
Creates anif
statement.Creates an import.<T> CtInterface<T>
Creates an interface.<T> CtIntersectionTypeReference<T>
Creates an intersection type reference.<T> CtConstructor<T>
Creates an invisible array constructor.<T> CtInvocation<T>
Creates an invocation expression.Creates a javadoc comment.Creates a javadoc tag.<T> CtLambda<T>
Creates a new anonymous method expression.<T> CtLiteral<T>
Creates a literal expression.<T> CtLocalVariable<T>
Creates a local variable declaration statement.<T> CtLocalVariableReference<T>
Creates a local variable reference.<T> CtMethod<T>
Creates a method.Creates a Java 9 moduleCreates a reference to a Java 9 moduleCreates a "requires" directive for a Java 9 module file<T> CtNewArray<T>
Creates a new array expression.<T> CtNewClass<T>
Creates a new anonymous class expression.<T, A extends T>
CtOperatorAssignment<T,A>Creates a new operator assignment (like +=).Creates a package.Creates a package declaration.Creates a "export" directive for a Java 9 module fileCreates a package reference.<T> CtParameter<T>
Creates a parameter.<T> CtParameterReference<T>
Creates a parameter reference.createPartialSourcePosition(CompilationUnit compilationUnit)
Creates a source position that points to the given compilation unitCreates a "provides" directive for a Java 9 module fileCreates a record.Creates a record component.<R> CtReturn<R>
Creates areturn
statement.createSourcePosition(CompilationUnit compilationUnit, int startSource, int end, int[] lineSeparatorPositions)
Creates a source position.<R> CtStatementList
Creates a statement list.<T> CtSuperAccess<T>
Creates an access expression to super.<S> CtSwitch<S>
Creates aswitch
statement.<T, S> CtSwitchExpression<T,S>
Creates aswitch
expression.Creates asynchronized
statement.Creates a TextBlock String Literal<T> CtThisAccess<T>
Creates an access expression to this.Creates athrow
statement.Creates atry
block.Creates atry
with resource block.<T> CtTypeAccess<T>
Creates a type access expression.Create a wildcard reference to a type member, used in a static importCreates a type parameter declaration.Creates a type parameter reference.Creates a Type Pattern<T> CtTypeReference<T>
Creates a type reference.<T> CtUnaryOperator<T>
Creates a unary operator expression.<T> CtUnboundVariableReference<T>
Creates an unbound variable used in noclasspath.Creates an unresolved import.Creates a "uses" directive for a Java 9 module file<T> CtVariableRead<T>
Creates a variable read expression.<T> CtVariableWrite<T>
Creates a variable write expression.Creates awhile
loop.Creates a wildcard reference.Creates ayield
statementGets the main factory of that core factory (cannot benull
).void
setMainFactory(Factory mainFactory)
Sets the main factory of that core factory.
-
Constructor Details
-
DefaultCoreFactory
public DefaultCoreFactory()Default constructor.
-
-
Method Details
-
clone
Description copied from interface:CoreFactory
Recursively clones a given element of the metamodel and all its child elements.- Specified by:
clone
in interfaceCoreFactory
- Type Parameters:
T
- the element's type- Parameters:
object
- the element- Returns:
- a clone of
element
- See Also:
CtElement.clone()
-
createAnnotation
Description copied from interface:CoreFactory
Creates an annotation.- Specified by:
createAnnotation
in interfaceCoreFactory
-
createAnnotationType
Description copied from interface:CoreFactory
Creates an annotation type.- Specified by:
createAnnotationType
in interfaceCoreFactory
-
createAnonymousExecutable
Description copied from interface:CoreFactory
Creates an anonymous executable.- Specified by:
createAnonymousExecutable
in interfaceCoreFactory
-
createArrayRead
Description copied from interface:CoreFactory
Creates an array read access expression.- Specified by:
createArrayRead
in interfaceCoreFactory
-
createArrayWrite
Description copied from interface:CoreFactory
Creates an array write access expression.- Specified by:
createArrayWrite
in interfaceCoreFactory
-
createArrayTypeReference
Description copied from interface:CoreFactory
Creates an array type reference.- Specified by:
createArrayTypeReference
in interfaceCoreFactory
-
createAssert
Description copied from interface:CoreFactory
Creates anassert
statement.- Specified by:
createAssert
in interfaceCoreFactory
-
createAssignment
Description copied from interface:CoreFactory
Creates an assignment expression.- Specified by:
createAssignment
in interfaceCoreFactory
-
createBinaryOperator
Description copied from interface:CoreFactory
Creates a binary operator.- Specified by:
createBinaryOperator
in interfaceCoreFactory
-
createBlock
Description copied from interface:CoreFactory
Creates a block.- Specified by:
createBlock
in interfaceCoreFactory
-
createBreak
Description copied from interface:CoreFactory
Creates abreak
statement.- Specified by:
createBreak
in interfaceCoreFactory
-
createCase
Description copied from interface:CoreFactory
Creates acase
clause.- Specified by:
createCase
in interfaceCoreFactory
-
createCatch
Description copied from interface:CoreFactory
Creates acatch
clause.- Specified by:
createCatch
in interfaceCoreFactory
-
createClass
Description copied from interface:CoreFactory
Creates a class.- Specified by:
createClass
in interfaceCoreFactory
-
createTypeParameter
Description copied from interface:CoreFactory
Creates a type parameter declaration.- Specified by:
createTypeParameter
in interfaceCoreFactory
-
createConditional
Description copied from interface:CoreFactory
Creates a conditional expression (boolExpr?ifTrue:ifFalse
).- Specified by:
createConditional
in interfaceCoreFactory
-
createConstructor
Description copied from interface:CoreFactory
Creates a constructor.- Specified by:
createConstructor
in interfaceCoreFactory
-
createInvisibleArrayConstructor
Description copied from interface:CoreFactory
Creates an invisible array constructor.- Specified by:
createInvisibleArrayConstructor
in interfaceCoreFactory
-
createContinue
Description copied from interface:CoreFactory
Creates acontinue
statement.- Specified by:
createContinue
in interfaceCoreFactory
-
createDo
Description copied from interface:CoreFactory
Creates ado
loop.- Specified by:
createDo
in interfaceCoreFactory
-
createEnum
Description copied from interface:CoreFactory
Creates an enum.- Specified by:
createEnum
in interfaceCoreFactory
-
createExecutableReference
Description copied from interface:CoreFactory
Creates an executable reference.- Specified by:
createExecutableReference
in interfaceCoreFactory
-
createField
Description copied from interface:CoreFactory
Creates a field.- Specified by:
createField
in interfaceCoreFactory
-
createEnumValue
Description copied from interface:CoreFactory
Creates an enum value.- Specified by:
createEnumValue
in interfaceCoreFactory
-
createFieldRead
Description copied from interface:CoreFactory
Creates a field read access.- Specified by:
createFieldRead
in interfaceCoreFactory
-
createFieldWrite
Description copied from interface:CoreFactory
Creates a field write access.- Specified by:
createFieldWrite
in interfaceCoreFactory
-
createAnnotationFieldAccess
Description copied from interface:CoreFactory
Create an access to annotation value- Specified by:
createAnnotationFieldAccess
in interfaceCoreFactory
- Returns:
-
createUnboundVariableReference
Description copied from interface:CoreFactory
Creates an unbound variable used in noclasspath.- Specified by:
createUnboundVariableReference
in interfaceCoreFactory
-
createFieldReference
Description copied from interface:CoreFactory
Creates a field reference.- Specified by:
createFieldReference
in interfaceCoreFactory
-
createFor
Description copied from interface:CoreFactory
Creates afor
loop.- Specified by:
createFor
in interfaceCoreFactory
-
createForEach
Description copied from interface:CoreFactory
Creates aforeach
loop.- Specified by:
createForEach
in interfaceCoreFactory
-
createIf
Description copied from interface:CoreFactory
Creates anif
statement.- Specified by:
createIf
in interfaceCoreFactory
-
createInterface
Description copied from interface:CoreFactory
Creates an interface.- Specified by:
createInterface
in interfaceCoreFactory
-
createInvocation
Description copied from interface:CoreFactory
Creates an invocation expression.- Specified by:
createInvocation
in interfaceCoreFactory
-
createLiteral
Description copied from interface:CoreFactory
Creates a literal expression.- Specified by:
createLiteral
in interfaceCoreFactory
-
createTextBlock
Description copied from interface:CoreFactory
Creates a TextBlock String Literal- Specified by:
createTextBlock
in interfaceCoreFactory
-
createLocalVariable
Description copied from interface:CoreFactory
Creates a local variable declaration statement.- Specified by:
createLocalVariable
in interfaceCoreFactory
-
createLocalVariableReference
Description copied from interface:CoreFactory
Creates a local variable reference.- Specified by:
createLocalVariableReference
in interfaceCoreFactory
-
createCatchVariable
Description copied from interface:CoreFactory
Creates a catch variable declaration statement.- Specified by:
createCatchVariable
in interfaceCoreFactory
-
createCatchVariableReference
Description copied from interface:CoreFactory
Creates a catch variable reference.- Specified by:
createCatchVariableReference
in interfaceCoreFactory
-
createMethod
Description copied from interface:CoreFactory
Creates a method.- Specified by:
createMethod
in interfaceCoreFactory
-
createAnnotationMethod
Description copied from interface:CoreFactory
Creates an annotation method.- Specified by:
createAnnotationMethod
in interfaceCoreFactory
-
createNewArray
Description copied from interface:CoreFactory
Creates a new array expression.- Specified by:
createNewArray
in interfaceCoreFactory
-
createConstructorCall
Description copied from interface:CoreFactory
Creates a constructor call expression. Example to build "new Foo()":CtConstructorCall call = spoon.getFactory().Core().createConstructorCall(); call.setType(spoon.getFactory().Core().createTypeReference().setSimpleName("Foo"));
- Specified by:
createConstructorCall
in interfaceCoreFactory
-
createNewClass
Description copied from interface:CoreFactory
Creates a new anonymous class expression.- Specified by:
createNewClass
in interfaceCoreFactory
-
createLambda
Description copied from interface:CoreFactory
Creates a new anonymous method expression.- Specified by:
createLambda
in interfaceCoreFactory
-
createExecutableReferenceExpression
public <T, E extends CtExpression<?>> CtExecutableReferenceExpression<T,E> createExecutableReferenceExpression()Description copied from interface:CoreFactory
Creates a new executable reference expression.- Specified by:
createExecutableReferenceExpression
in interfaceCoreFactory
-
createOperatorAssignment
Description copied from interface:CoreFactory
Creates a new operator assignment (like +=).- Specified by:
createOperatorAssignment
in interfaceCoreFactory
-
createPackage
Description copied from interface:CoreFactory
Creates a package.- Specified by:
createPackage
in interfaceCoreFactory
-
createPackageReference
Description copied from interface:CoreFactory
Creates a package reference.- Specified by:
createPackageReference
in interfaceCoreFactory
-
createParameter
Description copied from interface:CoreFactory
Creates a parameter.- Specified by:
createParameter
in interfaceCoreFactory
-
createParameterReference
Description copied from interface:CoreFactory
Creates a parameter reference.- Specified by:
createParameterReference
in interfaceCoreFactory
-
createReturn
Description copied from interface:CoreFactory
Creates areturn
statement.- Specified by:
createReturn
in interfaceCoreFactory
-
createStatementList
Description copied from interface:CoreFactory
Creates a statement list.- Specified by:
createStatementList
in interfaceCoreFactory
-
createSwitch
Description copied from interface:CoreFactory
Creates aswitch
statement.- Specified by:
createSwitch
in interfaceCoreFactory
-
createSwitchExpression
Description copied from interface:CoreFactory
Creates aswitch
expression.- Specified by:
createSwitchExpression
in interfaceCoreFactory
-
createSynchronized
Description copied from interface:CoreFactory
Creates asynchronized
statement.- Specified by:
createSynchronized
in interfaceCoreFactory
-
createThrow
Description copied from interface:CoreFactory
Creates athrow
statement.- Specified by:
createThrow
in interfaceCoreFactory
-
createTry
Description copied from interface:CoreFactory
Creates atry
block.- Specified by:
createTry
in interfaceCoreFactory
-
createTryWithResource
Description copied from interface:CoreFactory
Creates atry
with resource block.- Specified by:
createTryWithResource
in interfaceCoreFactory
-
createTypeParameterReference
Description copied from interface:CoreFactory
Creates a type parameter reference.- Specified by:
createTypeParameterReference
in interfaceCoreFactory
-
createWildcardReference
Description copied from interface:CoreFactory
Creates a wildcard reference.- Specified by:
createWildcardReference
in interfaceCoreFactory
-
createIntersectionTypeReference
Description copied from interface:CoreFactory
Creates an intersection type reference.- Specified by:
createIntersectionTypeReference
in interfaceCoreFactory
-
createTypeReference
Description copied from interface:CoreFactory
Creates a type reference.- Specified by:
createTypeReference
in interfaceCoreFactory
-
createTypeAccess
Description copied from interface:CoreFactory
Creates a type access expression.- Specified by:
createTypeAccess
in interfaceCoreFactory
-
createUnaryOperator
Description copied from interface:CoreFactory
Creates a unary operator expression.- Specified by:
createUnaryOperator
in interfaceCoreFactory
-
createVariableRead
Description copied from interface:CoreFactory
Creates a variable read expression.- Specified by:
createVariableRead
in interfaceCoreFactory
-
createVariableWrite
Description copied from interface:CoreFactory
Creates a variable write expression.- Specified by:
createVariableWrite
in interfaceCoreFactory
-
createCodeSnippetExpression
Description copied from interface:CoreFactory
Creates a code snippet expression.- Specified by:
createCodeSnippetExpression
in interfaceCoreFactory
-
createCodeSnippetStatement
Description copied from interface:CoreFactory
Creates a code snippet statement.- Specified by:
createCodeSnippetStatement
in interfaceCoreFactory
-
createComment
Description copied from interface:CoreFactory
Creates a comment.- Specified by:
createComment
in interfaceCoreFactory
-
createJavaDoc
Description copied from interface:CoreFactory
Creates a javadoc comment.- Specified by:
createJavaDoc
in interfaceCoreFactory
-
createJavaDocTag
Description copied from interface:CoreFactory
Creates a javadoc tag.- Specified by:
createJavaDocTag
in interfaceCoreFactory
-
createWhile
Description copied from interface:CoreFactory
Creates awhile
loop.- Specified by:
createWhile
in interfaceCoreFactory
-
createImport
Description copied from interface:CoreFactory
Creates an import.- Specified by:
createImport
in interfaceCoreFactory
-
createUnresolvedImport
Description copied from interface:CoreFactory
Creates an unresolved import. CtUnresolvedImport stores the original content of the imort as a String in order to be able to restituate it when pretty printing.- Specified by:
createUnresolvedImport
in interfaceCoreFactory
-
createPackageDeclaration
Description copied from interface:CoreFactory
Creates a package declaration.- Specified by:
createPackageDeclaration
in interfaceCoreFactory
-
getMainFactory
Description copied from interface:CoreFactory
Gets the main factory of that core factory (cannot benull
).- Specified by:
getMainFactory
in interfaceCoreFactory
-
setMainFactory
Description copied from interface:CoreFactory
Sets the main factory of that core factory.- Specified by:
setMainFactory
in interfaceCoreFactory
-
createSourcePosition
public SourcePosition createSourcePosition(CompilationUnit compilationUnit, int startSource, int end, int[] lineSeparatorPositions)Description copied from interface:CoreFactory
Creates a source position.- Specified by:
createSourcePosition
in interfaceCoreFactory
-
createPartialSourcePosition
Description copied from interface:CoreFactory
Creates a source position that points to the given compilation unit- Specified by:
createPartialSourcePosition
in interfaceCoreFactory
-
createCompoundSourcePosition
public CompoundSourcePosition createCompoundSourcePosition(CompilationUnit compilationUnit, int startSource, int end, int declarationStart, int declarationEnd, int[] lineSeparatorPositions)Description copied from interface:CoreFactory
Creates a compound source position.- Specified by:
createCompoundSourcePosition
in interfaceCoreFactory
-
createDeclarationSourcePosition
public DeclarationSourcePosition createDeclarationSourcePosition(CompilationUnit compilationUnit, int startSource, int end, int modifierStart, int modifierEnd, int declarationStart, int declarationEnd, int[] lineSeparatorPositions)Description copied from interface:CoreFactory
Creates a declaration source position.- Specified by:
createDeclarationSourcePosition
in interfaceCoreFactory
-
createBodyHolderSourcePosition
public BodyHolderSourcePosition createBodyHolderSourcePosition(CompilationUnit compilationUnit, int nameStart, int nameEnd, int modifierStart, int modifierEnd, int declarationStart, int declarationEnd, int bodyStart, int bodyEnd, int[] lineSeparatorPositions)Description copied from interface:CoreFactory
Creates a body holder source position.- Specified by:
createBodyHolderSourcePosition
in interfaceCoreFactory
-
createCompilationUnit
Description copied from interface:CoreFactory
Creates a compilation unit.- Specified by:
createCompilationUnit
in interfaceCoreFactory
-
createThisAccess
Description copied from interface:CoreFactory
Creates an access expression to this.- Specified by:
createThisAccess
in interfaceCoreFactory
-
createSuperAccess
Description copied from interface:CoreFactory
Creates an access expression to super.- Specified by:
createSuperAccess
in interfaceCoreFactory
-
create
Description copied from interface:CoreFactory
Creates an instance of the concrete metamodel class given as parameter. This is in particular useful when one uses reflection.- Specified by:
create
in interfaceCoreFactory
-
createTypeMemberWildcardImportReference
Description copied from interface:CoreFactory
Create a wildcard reference to a type member, used in a static import- Specified by:
createTypeMemberWildcardImportReference
in interfaceCoreFactory
-
createModule
Description copied from interface:CoreFactory
Creates a Java 9 module- Specified by:
createModule
in interfaceCoreFactory
-
createModuleReference
Description copied from interface:CoreFactory
Creates a reference to a Java 9 module- Specified by:
createModuleReference
in interfaceCoreFactory
-
createModuleRequirement
Description copied from interface:CoreFactory
Creates a "requires" directive for a Java 9 module file- Specified by:
createModuleRequirement
in interfaceCoreFactory
-
createPackageExport
Description copied from interface:CoreFactory
Creates a "export" directive for a Java 9 module file- Specified by:
createPackageExport
in interfaceCoreFactory
-
createProvidedService
Description copied from interface:CoreFactory
Creates a "provides" directive for a Java 9 module file- Specified by:
createProvidedService
in interfaceCoreFactory
-
createUsedService
Description copied from interface:CoreFactory
Creates a "uses" directive for a Java 9 module file- Specified by:
createUsedService
in interfaceCoreFactory
-
createYieldStatement
Description copied from interface:CoreFactory
Creates ayield
statement- Specified by:
createYieldStatement
in interfaceCoreFactory
- Returns:
- yieldStatement
-
createTypePattern
Description copied from interface:CoreFactory
Creates a Type Pattern- Specified by:
createTypePattern
in interfaceCoreFactory
- Returns:
- a new Type Pattern instance.
-
createRecord
Description copied from interface:CoreFactory
Creates a record.- Specified by:
createRecord
in interfaceCoreFactory
- Returns:
- the created record.
-
createRecordComponent
Description copied from interface:CoreFactory
Creates a record component.- Specified by:
createRecordComponent
in interfaceCoreFactory
- Returns:
- the created record component.
-