Class ImportInfo

java.lang.Object
org.apache.batik.script.ImportInfo

public class ImportInfo extends Object
This class represents a list of Java classes/packages to import into a scripting environment. It can initializes it's self by reading a file, from the classpath (META_INF/imports/script.xt). The format of the file is as follows: Anything after a '#' on a line is ignored. The first space delimited token on a line must be either 'class' or 'package'. The remainder of a line is whitespace delimited, fully qualified, Java class/package name (i.e. java.lang.System).
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected Set
     
    protected Set
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    Construct an empty ImportInfo instance
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Add a class to the set of classes to import (must be a fully qualified classname - "java.lang.System").
    void
    Add imports read from a URL to this ImportInfo instance.
    void
    Add a package to the set of packages to import (must be a fully qualified package - "java.lang").
    Return an unmodifiable iterator over the list of classes
    static ImportInfo
    Returns the default ImportInfo instance.
    Return an unmodifiable iterator over the list of packages
    boolean
    Remove a class from the set of classes to import (must be a fully qualified classname - "java.lang.System").
    boolean
    Remove a package from the set of packages to import (must be a fully qualified package - "java.lang").

    Methods inherited from class java.lang.Object

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

    • classes

      protected Set classes
    • packages

      protected Set packages
  • Constructor Details

    • ImportInfo

      public ImportInfo()
      Construct an empty ImportInfo instance
  • Method Details

    • getImports

      public static ImportInfo getImports()
      Returns the default ImportInfo instance. This instance is initialized by reading the file identified by 'importFile'.
    • getClasses

      public Iterator getClasses()
      Return an unmodifiable iterator over the list of classes
    • getPackages

      public Iterator getPackages()
      Return an unmodifiable iterator over the list of packages
    • addClass

      public void addClass(String cls)
      Add a class to the set of classes to import (must be a fully qualified classname - "java.lang.System").
    • addPackage

      public void addPackage(String pkg)
      Add a package to the set of packages to import (must be a fully qualified package - "java.lang").
    • removeClass

      public boolean removeClass(String cls)
      Remove a class from the set of classes to import (must be a fully qualified classname - "java.lang.System").
      Returns:
      true if the class was present.
    • removePackage

      public boolean removePackage(String pkg)
      Remove a package from the set of packages to import (must be a fully qualified package - "java.lang").
      Returns:
      true if the package was present.
    • addImports

      public void addImports(URL src) throws IOException
      Add imports read from a URL to this ImportInfo instance. See the class documentation for the expected format of the file.
      Throws:
      IOException