Package javax.el

Class ImportHandler



  • public class ImportHandler
    extends java.lang.Object
    Handles imports of class names and package names. An imported package name implicitly imports all the classes in the package. A class that has been imported can be used without its package name. The name is resolved to its full (package and class) name at evaluation time.
    • Constructor Summary

      Constructors 
      Constructor Description
      ImportHandler​()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void importClass​(java.lang.String name)
      Import a class.
      void importPackage​(java.lang.String packageName)
      Import all the classes in a package.
      void importStatic​(java.lang.String name)
      Import a static field or method.
      java.lang.Class<?> resolveClass​(java.lang.String name)
      Resolve a class name.
      java.lang.Class<?> resolveStatic​(java.lang.String name)
      Resolve a static field or method name.
      • Methods inherited from class java.lang.Object

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

      • ImportHandler

        public ImportHandler​()
    • Method Detail

      • importStatic

        public void importStatic​(java.lang.String name)
                          throws ELException
        Import a static field or method.
        Parameters:
        name - The static member name, including the full class name, to be imported
        Throws:
        ELException - if the name does not include a ".".
      • importClass

        public void importClass​(java.lang.String name)
                         throws ELException
        Import a class.
        Parameters:
        name - The full class name of the class to be imported
        Throws:
        ELException - if the name does not include a ".".
      • importPackage

        public void importPackage​(java.lang.String packageName)
        Import all the classes in a package.
        Parameters:
        packageName - The package name to be imported
      • resolveClass

        public java.lang.Class<?> resolveClass​(java.lang.String name)
        Resolve a class name.
        Parameters:
        name - The name of the class (without package name) to be resolved.
        Returns:
        If the class has been imported previously, with importClass(java.lang.String) or importPackage(java.lang.String), then its Class instance. Otherwise null.
        Throws:
        ELException - if the class is abstract or is an interface, or not public.
      • resolveStatic

        public java.lang.Class<?> resolveStatic​(java.lang.String name)
        Resolve a static field or method name.
        Parameters:
        name - The name of the member(without package and class name) to be resolved.
        Returns:
        If the field or method has been imported previously, with importStatic(java.lang.String), then the class object representing the class that declares the static field or method. Otherwise null.
        Throws:
        ELException - if the class is not public, or is abstract or is an interface.