Package org.apache.batik.script
Class ImportInfo
java.lang.Object
org.apache.batik.script.ImportInfo
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
FieldsModifier and TypeFieldDescriptionprotected Set
(package private) static final String
(package private) static final String
Default file to read imports from, can be overridden by setting the 'org.apache.batik.script.imports' System property(package private) static ImportInfo
(package private) static String
protected Set
(package private) static final String
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Add a class to the set of classes to import (must be a fully qualified classname - "java.lang.System").void
addImports
(URL src) Add imports read from a URL to this ImportInfo instance.void
addPackage
(String pkg) 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 classesstatic ImportInfo
Returns the default ImportInfo instance.Return an unmodifiable iterator over the list of packages(package private) static ImportInfo
boolean
removeClass
(String cls) Remove a class from the set of classes to import (must be a fully qualified classname - "java.lang.System").boolean
removePackage
(String pkg) Remove a package from the set of packages to import (must be a fully qualified package - "java.lang").
-
Field Details
-
defaultFile
Default file to read imports from, can be overridden by setting the 'org.apache.batik.script.imports' System property- See Also:
-
importFile
-
defaultImports
-
classes
-
packages
-
classStr
- See Also:
-
packageStr
- See Also:
-
-
Constructor Details
-
ImportInfo
public ImportInfo()Construct an empty ImportInfo instance
-
-
Method Details
-
getImports
Returns the default ImportInfo instance. This instance is initialized by reading the file identified by 'importFile'. -
readImports
-
getClasses
Return an unmodifiable iterator over the list of classes -
getPackages
Return an unmodifiable iterator over the list of packages -
addClass
Add a class to the set of classes to import (must be a fully qualified classname - "java.lang.System"). -
addPackage
Add a package to the set of packages to import (must be a fully qualified package - "java.lang"). -
removeClass
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
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
Add imports read from a URL to this ImportInfo instance. See the class documentation for the expected format of the file.- Throws:
IOException
-