Class CompilationUnitFactory

  • public class CompilationUnitFactory
    extends SubFactory
    A factory to create some evaluation utilities on the Spoon metamodel.
    • Constructor Detail

      • CompilationUnitFactory

        public CompilationUnitFactory​(Factory factory)
        Creates the evaluation factory.
    • Method Detail

      • getMap

        public java.util.Map<java.lang.String,​CompilationUnit> getMap()
        Gets an immutable compilation unit map. If you want to add a type to be pretty-printed, use addType(CtType).
        a map (path -> CompilationUnit)
      • create

        public CompilationUnit create()
        Creates a compilation unit with no associated files.
      • removeType

        public void removeType​(CtType type)
        remove a type from the list of types to be pretty-printed
      • getOrCreate

        public CompilationUnit getOrCreate​(CtType type)
        Returns the compilation unit corresponding to this type. Creates one on-the-fly if needed.
      • getOrCreate

        public CompilationUnit getOrCreate​(java.lang.String filePath)
        Creates or gets a compilation unit for a given file path.
      • removeFromCache

        public CompilationUnit removeFromCache​(java.lang.String filePath)
        Removes compilation unit from the cache and returns it Used by JDTSnippetCompiler to remove processed snippet from the cache
        filePath -
        a cached compilation unit or null