Package spoon.reflect.factory
Class CompilationUnitFactory
java.lang.Object
spoon.reflect.factory.SubFactory
spoon.reflect.factory.CompilationUnitFactory
A factory to create some evaluation utilities on the Spoon metamodel.
-
Field Summary
Fields inherited from class spoon.reflect.factory.SubFactory
factory
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionadd a new type to be pretty-printedcreate()
Creates a compilation unit with no associated files.getMap()
Gets an immutable compilation unit map.getOrCreate(String filePath)
Creates or gets a compilation unit for a given file path.getOrCreate(CtModule module)
getOrCreate(CtPackage ctPackage)
getOrCreate(CtType type)
Returns the compilation unit corresponding to this type.removeFromCache(String filePath)
Removes compilation unit from the cache and returns it Used by JDTSnippetCompiler to remove processed snippet from the cachevoid
removeType(CtType<?> type)
remove a type from the list of types to be pretty-printed
-
Constructor Details
-
CompilationUnitFactory
Creates the evaluation factory.
-
-
Method Details
-
getMap
Gets an immutable compilation unit map. If you want to add a type to be pretty-printed, useaddType(CtType)
.- Returns:
- a map (path ->
CompilationUnit
)
-
create
Creates a compilation unit with no associated files. -
getOrCreate
-
removeType
remove a type from the list of types to be pretty-printed -
addType
add a new type to be pretty-printed -
getOrCreate
Returns the compilation unit corresponding to this type. Creates one on-the-fly if needed. -
getOrCreate
-
getOrCreate
Creates or gets a compilation unit for a given file path. -
removeFromCache
Removes compilation unit from the cache and returns it Used by JDTSnippetCompiler to remove processed snippet from the cache- Parameters:
filePath
-- Returns:
- a cached compilation unit or null
-