Class ImportedClassResolver

  • All Implemented Interfaces:
    java.io.Serializable, ClassResolver

    public class ImportedClassResolver
    extends java.lang.Object
    implements ClassResolver, java.io.Serializable
    The class resolve that allows to import classes and packages, like Java's import statement does.

    For example,

    
     ImportedClassResolver resolver = new ImportedClassResolver();
     resolver.addImportedClass("org.zkoss.lang.*");
     resolver.addImportedClass("org.zkoss.util.Maps");
     resolver.resolveClass("ImportedClassResolver");
    Since:
    6.0.0
    Author:
    tomyeh
    See Also:
    SimpleClassResolver, Serialized Form
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addAll​(ImportedClassResolver resolver)
      Adds all imported classes of the given class resolver.
      void addImportedClass​(java.lang.String clsptn)
      Adds an imported class Like Java, it is used to import a class or a package of classes, so that it simplifies the use of the apply attribute, the init directive and others.
      java.util.List<java.lang.String> getImportedClasses()
      Returns a readonly list of the imported class.
      java.lang.Class<?> resolveClass​(java.lang.String clsnm)
      Resolves the class of the specified name.
      • Methods inherited from class java.lang.Object

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

      • ImportedClassResolver

        public ImportedClassResolver()
    • Method Detail

      • addImportedClass

        public void addImportedClass​(java.lang.String clsptn)
                              throws java.lang.ClassNotFoundException
        Adds an imported class Like Java, it is used to import a class or a package of classes, so that it simplifies the use of the apply attribute, the init directive and others.
        Parameters:
        clsptn - the class's fully-qualified name, e.g., com.foo.FooComposer, a wildcard representing all classes of the give package, e.g., com.foo.*.
        Throws:
        java.lang.ClassNotFoundException
      • getImportedClasses

        public java.util.List<java.lang.String> getImportedClasses()
        Returns a readonly list of the imported class.
      • addAll

        public void addAll​(ImportedClassResolver resolver)
        Adds all imported classes of the given class resolver.
      • resolveClass

        public java.lang.Class<?> resolveClass​(java.lang.String clsnm)
                                        throws java.lang.ClassNotFoundException
        Description copied from interface: ClassResolver
        Resolves the class of the specified name.
        Specified by:
        resolveClass in interface ClassResolver
        Throws:
        java.lang.ClassNotFoundException - if the class is not found.