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
Constructors -
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 anassertstatement.<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 abreakstatement.<S> CtCase<S>Creates acaseclause.Creates acatchclause.<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 acontinuestatement.createDeclarationSourcePosition(CompilationUnit compilationUnit, int startSource, int end, int modifierStart, int modifierEnd, int declarationStart, int declarationEnd, int[] lineSeparatorPositions)Creates a declaration source position.createDo()Creates adoloop.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 aforloop.Creates aforeachloop.createIf()Creates anifstatement.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 areturnstatement.createSourcePosition(CompilationUnit compilationUnit, int startSource, int end, int[] lineSeparatorPositions)Creates a source position.<R> CtStatementListCreates a statement list.<T> CtSuperAccess<T>Creates an access expression to super.<S> CtSwitch<S>Creates aswitchstatement.<T, S> CtSwitchExpression<T,S>Creates aswitchexpression.Creates asynchronizedstatement.Creates a TextBlock String Literal<T> CtThisAccess<T>Creates an access expression to this.Creates athrowstatement.Creates atryblock.Creates atrywith 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 awhileloop.Creates a wildcard reference.Creates ayieldstatementGets the main factory of that core factory (cannot benull).voidsetMainFactory(Factory mainFactory)Sets the main factory of that core factory.
-
Constructor Details
-
DefaultCoreFactory
public DefaultCoreFactory()Default constructor.
-
-
Method Details
-
clone
Description copied from interface:CoreFactoryRecursively clones a given element of the metamodel and all its child elements.- Specified by:
clonein 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:CoreFactoryCreates an annotation.- Specified by:
createAnnotationin interfaceCoreFactory
-
createAnnotationType
Description copied from interface:CoreFactoryCreates an annotation type.- Specified by:
createAnnotationTypein interfaceCoreFactory
-
createAnonymousExecutable
Description copied from interface:CoreFactoryCreates an anonymous executable.- Specified by:
createAnonymousExecutablein interfaceCoreFactory
-
createArrayRead
Description copied from interface:CoreFactoryCreates an array read access expression.- Specified by:
createArrayReadin interfaceCoreFactory
-
createArrayWrite
Description copied from interface:CoreFactoryCreates an array write access expression.- Specified by:
createArrayWritein interfaceCoreFactory
-
createArrayTypeReference
Description copied from interface:CoreFactoryCreates an array type reference.- Specified by:
createArrayTypeReferencein interfaceCoreFactory
-
createAssert
Description copied from interface:CoreFactoryCreates anassertstatement.- Specified by:
createAssertin interfaceCoreFactory
-
createAssignment
Description copied from interface:CoreFactoryCreates an assignment expression.- Specified by:
createAssignmentin interfaceCoreFactory
-
createBinaryOperator
Description copied from interface:CoreFactoryCreates a binary operator.- Specified by:
createBinaryOperatorin interfaceCoreFactory
-
createBlock
Description copied from interface:CoreFactoryCreates a block.- Specified by:
createBlockin interfaceCoreFactory
-
createBreak
Description copied from interface:CoreFactoryCreates abreakstatement.- Specified by:
createBreakin interfaceCoreFactory
-
createCase
Description copied from interface:CoreFactoryCreates acaseclause.- Specified by:
createCasein interfaceCoreFactory
-
createCatch
Description copied from interface:CoreFactoryCreates acatchclause.- Specified by:
createCatchin interfaceCoreFactory
-
createClass
Description copied from interface:CoreFactoryCreates a class.- Specified by:
createClassin interfaceCoreFactory
-
createTypeParameter
Description copied from interface:CoreFactoryCreates a type parameter declaration.- Specified by:
createTypeParameterin interfaceCoreFactory
-
createConditional
Description copied from interface:CoreFactoryCreates a conditional expression (boolExpr?ifTrue:ifFalse).- Specified by:
createConditionalin interfaceCoreFactory
-
createConstructor
Description copied from interface:CoreFactoryCreates a constructor.- Specified by:
createConstructorin interfaceCoreFactory
-
createInvisibleArrayConstructor
Description copied from interface:CoreFactoryCreates an invisible array constructor.- Specified by:
createInvisibleArrayConstructorin interfaceCoreFactory
-
createContinue
Description copied from interface:CoreFactoryCreates acontinuestatement.- Specified by:
createContinuein interfaceCoreFactory
-
createDo
Description copied from interface:CoreFactoryCreates adoloop.- Specified by:
createDoin interfaceCoreFactory
-
createEnum
Description copied from interface:CoreFactoryCreates an enum.- Specified by:
createEnumin interfaceCoreFactory
-
createExecutableReference
Description copied from interface:CoreFactoryCreates an executable reference.- Specified by:
createExecutableReferencein interfaceCoreFactory
-
createField
Description copied from interface:CoreFactoryCreates a field.- Specified by:
createFieldin interfaceCoreFactory
-
createEnumValue
Description copied from interface:CoreFactoryCreates an enum value.- Specified by:
createEnumValuein interfaceCoreFactory
-
createFieldRead
Description copied from interface:CoreFactoryCreates a field read access.- Specified by:
createFieldReadin interfaceCoreFactory
-
createFieldWrite
Description copied from interface:CoreFactoryCreates a field write access.- Specified by:
createFieldWritein interfaceCoreFactory
-
createAnnotationFieldAccess
Description copied from interface:CoreFactoryCreate an access to annotation value- Specified by:
createAnnotationFieldAccessin interfaceCoreFactory- Returns:
-
createUnboundVariableReference
Description copied from interface:CoreFactoryCreates an unbound variable used in noclasspath.- Specified by:
createUnboundVariableReferencein interfaceCoreFactory
-
createFieldReference
Description copied from interface:CoreFactoryCreates a field reference.- Specified by:
createFieldReferencein interfaceCoreFactory
-
createFor
Description copied from interface:CoreFactoryCreates aforloop.- Specified by:
createForin interfaceCoreFactory
-
createForEach
Description copied from interface:CoreFactoryCreates aforeachloop.- Specified by:
createForEachin interfaceCoreFactory
-
createIf
Description copied from interface:CoreFactoryCreates anifstatement.- Specified by:
createIfin interfaceCoreFactory
-
createInterface
Description copied from interface:CoreFactoryCreates an interface.- Specified by:
createInterfacein interfaceCoreFactory
-
createInvocation
Description copied from interface:CoreFactoryCreates an invocation expression.- Specified by:
createInvocationin interfaceCoreFactory
-
createLiteral
Description copied from interface:CoreFactoryCreates a literal expression.- Specified by:
createLiteralin interfaceCoreFactory
-
createTextBlock
Description copied from interface:CoreFactoryCreates a TextBlock String Literal- Specified by:
createTextBlockin interfaceCoreFactory
-
createLocalVariable
Description copied from interface:CoreFactoryCreates a local variable declaration statement.- Specified by:
createLocalVariablein interfaceCoreFactory
-
createLocalVariableReference
Description copied from interface:CoreFactoryCreates a local variable reference.- Specified by:
createLocalVariableReferencein interfaceCoreFactory
-
createCatchVariable
Description copied from interface:CoreFactoryCreates a catch variable declaration statement.- Specified by:
createCatchVariablein interfaceCoreFactory
-
createCatchVariableReference
Description copied from interface:CoreFactoryCreates a catch variable reference.- Specified by:
createCatchVariableReferencein interfaceCoreFactory
-
createMethod
Description copied from interface:CoreFactoryCreates a method.- Specified by:
createMethodin interfaceCoreFactory
-
createAnnotationMethod
Description copied from interface:CoreFactoryCreates an annotation method.- Specified by:
createAnnotationMethodin interfaceCoreFactory
-
createNewArray
Description copied from interface:CoreFactoryCreates a new array expression.- Specified by:
createNewArrayin interfaceCoreFactory
-
createConstructorCall
Description copied from interface:CoreFactoryCreates 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:
createConstructorCallin interfaceCoreFactory
-
createNewClass
Description copied from interface:CoreFactoryCreates a new anonymous class expression.- Specified by:
createNewClassin interfaceCoreFactory
-
createLambda
Description copied from interface:CoreFactoryCreates a new anonymous method expression.- Specified by:
createLambdain interfaceCoreFactory
-
createExecutableReferenceExpression
public <T, E extends CtExpression<?>> CtExecutableReferenceExpression<T,E> createExecutableReferenceExpression()Description copied from interface:CoreFactoryCreates a new executable reference expression.- Specified by:
createExecutableReferenceExpressionin interfaceCoreFactory
-
createOperatorAssignment
Description copied from interface:CoreFactoryCreates a new operator assignment (like +=).- Specified by:
createOperatorAssignmentin interfaceCoreFactory
-
createPackage
Description copied from interface:CoreFactoryCreates a package.- Specified by:
createPackagein interfaceCoreFactory
-
createPackageReference
Description copied from interface:CoreFactoryCreates a package reference.- Specified by:
createPackageReferencein interfaceCoreFactory
-
createParameter
Description copied from interface:CoreFactoryCreates a parameter.- Specified by:
createParameterin interfaceCoreFactory
-
createParameterReference
Description copied from interface:CoreFactoryCreates a parameter reference.- Specified by:
createParameterReferencein interfaceCoreFactory
-
createReturn
Description copied from interface:CoreFactoryCreates areturnstatement.- Specified by:
createReturnin interfaceCoreFactory
-
createStatementList
Description copied from interface:CoreFactoryCreates a statement list.- Specified by:
createStatementListin interfaceCoreFactory
-
createSwitch
Description copied from interface:CoreFactoryCreates aswitchstatement.- Specified by:
createSwitchin interfaceCoreFactory
-
createSwitchExpression
Description copied from interface:CoreFactoryCreates aswitchexpression.- Specified by:
createSwitchExpressionin interfaceCoreFactory
-
createSynchronized
Description copied from interface:CoreFactoryCreates asynchronizedstatement.- Specified by:
createSynchronizedin interfaceCoreFactory
-
createThrow
Description copied from interface:CoreFactoryCreates athrowstatement.- Specified by:
createThrowin interfaceCoreFactory
-
createTry
Description copied from interface:CoreFactoryCreates atryblock.- Specified by:
createTryin interfaceCoreFactory
-
createTryWithResource
Description copied from interface:CoreFactoryCreates atrywith resource block.- Specified by:
createTryWithResourcein interfaceCoreFactory
-
createTypeParameterReference
Description copied from interface:CoreFactoryCreates a type parameter reference.- Specified by:
createTypeParameterReferencein interfaceCoreFactory
-
createWildcardReference
Description copied from interface:CoreFactoryCreates a wildcard reference.- Specified by:
createWildcardReferencein interfaceCoreFactory
-
createIntersectionTypeReference
Description copied from interface:CoreFactoryCreates an intersection type reference.- Specified by:
createIntersectionTypeReferencein interfaceCoreFactory
-
createTypeReference
Description copied from interface:CoreFactoryCreates a type reference.- Specified by:
createTypeReferencein interfaceCoreFactory
-
createTypeAccess
Description copied from interface:CoreFactoryCreates a type access expression.- Specified by:
createTypeAccessin interfaceCoreFactory
-
createUnaryOperator
Description copied from interface:CoreFactoryCreates a unary operator expression.- Specified by:
createUnaryOperatorin interfaceCoreFactory
-
createVariableRead
Description copied from interface:CoreFactoryCreates a variable read expression.- Specified by:
createVariableReadin interfaceCoreFactory
-
createVariableWrite
Description copied from interface:CoreFactoryCreates a variable write expression.- Specified by:
createVariableWritein interfaceCoreFactory
-
createCodeSnippetExpression
Description copied from interface:CoreFactoryCreates a code snippet expression.- Specified by:
createCodeSnippetExpressionin interfaceCoreFactory
-
createCodeSnippetStatement
Description copied from interface:CoreFactoryCreates a code snippet statement.- Specified by:
createCodeSnippetStatementin interfaceCoreFactory
-
createComment
Description copied from interface:CoreFactoryCreates a comment.- Specified by:
createCommentin interfaceCoreFactory
-
createJavaDoc
Description copied from interface:CoreFactoryCreates a javadoc comment.- Specified by:
createJavaDocin interfaceCoreFactory
-
createJavaDocTag
Description copied from interface:CoreFactoryCreates a javadoc tag.- Specified by:
createJavaDocTagin interfaceCoreFactory
-
createWhile
Description copied from interface:CoreFactoryCreates awhileloop.- Specified by:
createWhilein interfaceCoreFactory
-
createImport
Description copied from interface:CoreFactoryCreates an import.- Specified by:
createImportin interfaceCoreFactory
-
createUnresolvedImport
Description copied from interface:CoreFactoryCreates 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:
createUnresolvedImportin interfaceCoreFactory
-
createPackageDeclaration
Description copied from interface:CoreFactoryCreates a package declaration.- Specified by:
createPackageDeclarationin interfaceCoreFactory
-
getMainFactory
Description copied from interface:CoreFactoryGets the main factory of that core factory (cannot benull).- Specified by:
getMainFactoryin interfaceCoreFactory
-
setMainFactory
Description copied from interface:CoreFactorySets the main factory of that core factory.- Specified by:
setMainFactoryin interfaceCoreFactory
-
createSourcePosition
public SourcePosition createSourcePosition(CompilationUnit compilationUnit, int startSource, int end, int[] lineSeparatorPositions)Description copied from interface:CoreFactoryCreates a source position.- Specified by:
createSourcePositionin interfaceCoreFactory
-
createPartialSourcePosition
Description copied from interface:CoreFactoryCreates a source position that points to the given compilation unit- Specified by:
createPartialSourcePositionin interfaceCoreFactory
-
createCompoundSourcePosition
public CompoundSourcePosition createCompoundSourcePosition(CompilationUnit compilationUnit, int startSource, int end, int declarationStart, int declarationEnd, int[] lineSeparatorPositions)Description copied from interface:CoreFactoryCreates a compound source position.- Specified by:
createCompoundSourcePositionin 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:CoreFactoryCreates a declaration source position.- Specified by:
createDeclarationSourcePositionin 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:CoreFactoryCreates a body holder source position.- Specified by:
createBodyHolderSourcePositionin interfaceCoreFactory
-
createCompilationUnit
Description copied from interface:CoreFactoryCreates a compilation unit.- Specified by:
createCompilationUnitin interfaceCoreFactory
-
createThisAccess
Description copied from interface:CoreFactoryCreates an access expression to this.- Specified by:
createThisAccessin interfaceCoreFactory
-
createSuperAccess
Description copied from interface:CoreFactoryCreates an access expression to super.- Specified by:
createSuperAccessin interfaceCoreFactory
-
create
Description copied from interface:CoreFactoryCreates an instance of the concrete metamodel class given as parameter. This is in particular useful when one uses reflection.- Specified by:
createin interfaceCoreFactory
-
createTypeMemberWildcardImportReference
Description copied from interface:CoreFactoryCreate a wildcard reference to a type member, used in a static import- Specified by:
createTypeMemberWildcardImportReferencein interfaceCoreFactory
-
createModule
Description copied from interface:CoreFactoryCreates a Java 9 module- Specified by:
createModulein interfaceCoreFactory
-
createModuleReference
Description copied from interface:CoreFactoryCreates a reference to a Java 9 module- Specified by:
createModuleReferencein interfaceCoreFactory
-
createModuleRequirement
Description copied from interface:CoreFactoryCreates a "requires" directive for a Java 9 module file- Specified by:
createModuleRequirementin interfaceCoreFactory
-
createPackageExport
Description copied from interface:CoreFactoryCreates a "export" directive for a Java 9 module file- Specified by:
createPackageExportin interfaceCoreFactory
-
createProvidedService
Description copied from interface:CoreFactoryCreates a "provides" directive for a Java 9 module file- Specified by:
createProvidedServicein interfaceCoreFactory
-
createUsedService
Description copied from interface:CoreFactoryCreates a "uses" directive for a Java 9 module file- Specified by:
createUsedServicein interfaceCoreFactory
-
createYieldStatement
Description copied from interface:CoreFactoryCreates ayieldstatement- Specified by:
createYieldStatementin interfaceCoreFactory- Returns:
- yieldStatement
-
createTypePattern
Description copied from interface:CoreFactoryCreates a Type Pattern- Specified by:
createTypePatternin interfaceCoreFactory- Returns:
- a new Type Pattern instance.
-
createRecord
Description copied from interface:CoreFactoryCreates a record.- Specified by:
createRecordin interfaceCoreFactory- Returns:
- the created record.
-
createRecordComponent
Description copied from interface:CoreFactoryCreates a record component.- Specified by:
createRecordComponentin interfaceCoreFactory- Returns:
- the created record component.
-