Package sleep.parser

Class ImportManager


  • public class ImportManager
    extends java.lang.Object
    This class mantains a cache of imported package names and resolve classes for a Sleep parser. The existence of this class also allows these imports to be shared between parser instances. Value is allowing dynamically parsed code like eval, expr, compile_clousre etc.. to inherit their parents imported class information.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.util.HashMap classes  
      protected java.util.List imports  
    • Constructor Summary

      Constructors 
      Constructor Description
      ImportManager()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.Class findImportedClass​(java.lang.String name)
      Attempts to find a class, starts out with the passed in string itself, if that doesn't resolve then the string is appended to each imported package to see where the class might exist
      void importPackage​(java.lang.String packagez, java.lang.String from)
      Used by Sleep to import statement to save an imported package name.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • imports

        protected java.util.List imports
      • classes

        protected java.util.HashMap classes
    • Constructor Detail

      • ImportManager

        public ImportManager()
    • Method Detail

      • importPackage

        public void importPackage​(java.lang.String packagez,
                                  java.lang.String from)
        Used by Sleep to import statement to save an imported package name.
      • findImportedClass

        public java.lang.Class findImportedClass​(java.lang.String name)
        Attempts to find a class, starts out with the passed in string itself, if that doesn't resolve then the string is appended to each imported package to see where the class might exist