Package org.apache.batik.script
Class ImportInfo
- java.lang.Object
-
- org.apache.batik.script.ImportInfo
-
public class ImportInfo extends java.lang.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).- Version:
- $Id: ImportInfo.java 1808023 2017-09-11 12:43:22Z ssteiner $
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.Set
classes
(package private) static java.lang.String
classStr
(package private) static java.lang.String
defaultFile
Default file to read imports from, can be overridden by setting the 'org.apache.batik.script.imports' System property(package private) static ImportInfo
defaultImports
(package private) static java.lang.String
importFile
protected java.util.Set
packages
(package private) static java.lang.String
packageStr
-
Constructor Summary
Constructors Constructor Description ImportInfo()
Construct an empty ImportInfo instance
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addClass(java.lang.String cls)
Add a class to the set of classes to import (must be a fully qualified classname - "java.lang.System").void
addImports(java.net.URL src)
Add imports read from a URL to this ImportInfo instance.void
addPackage(java.lang.String pkg)
Add a package to the set of packages to import (must be a fully qualified package - "java.lang").java.util.Iterator
getClasses()
Return an unmodifiable iterator over the list of classesstatic ImportInfo
getImports()
Returns the default ImportInfo instance.java.util.Iterator
getPackages()
Return an unmodifiable iterator over the list of packages(package private) static ImportInfo
readImports()
boolean
removeClass(java.lang.String cls)
Remove a class from the set of classes to import (must be a fully qualified classname - "java.lang.System").boolean
removePackage(java.lang.String pkg)
Remove a package from the set of packages to import (must be a fully qualified package - "java.lang").
-
-
-
Field Detail
-
defaultFile
static final java.lang.String defaultFile
Default file to read imports from, can be overridden by setting the 'org.apache.batik.script.imports' System property- See Also:
- Constant Field Values
-
importFile
static java.lang.String importFile
-
defaultImports
static ImportInfo defaultImports
-
classes
protected java.util.Set classes
-
packages
protected java.util.Set packages
-
classStr
static final java.lang.String classStr
- See Also:
- Constant Field Values
-
packageStr
static final java.lang.String packageStr
- See Also:
- Constant Field Values
-
-
Method Detail
-
getImports
public static ImportInfo getImports()
Returns the default ImportInfo instance. This instance is initialized by reading the file identified by 'importFile'.
-
readImports
static ImportInfo readImports()
-
getClasses
public java.util.Iterator getClasses()
Return an unmodifiable iterator over the list of classes
-
getPackages
public java.util.Iterator getPackages()
Return an unmodifiable iterator over the list of packages
-
addClass
public void addClass(java.lang.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(java.lang.String pkg)
Add a package to the set of packages to import (must be a fully qualified package - "java.lang").
-
removeClass
public boolean removeClass(java.lang.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(java.lang.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(java.net.URL src) throws java.io.IOException
Add imports read from a URL to this ImportInfo instance. See the class documentation for the expected format of the file.- Throws:
java.io.IOException
-
-