public class LoaderConfiguration extends Object
Class used to configure a RootLoader from a stream or by using its methods.
The stream can be for example a FileInputStream from a file with the following format:
# comment main is classname load path load file load pathWith${property} load pathWith!{required.property} load path/*.jar load path/**/*.jar
load ./*.jar
or load *.jar
are not supported.Defining the main class is required unless setRequireMain(boolean) is called with false, before reading the configuration. You can use the wildcard "*" to filter the path, but only for files, not directories. To match directories use "**". The ${propertyname} is replaced by the value of the system's property name. You can use user.home here for example. If the property does not exist, an empty string will be used. If the path or file after the load command does not exist, the path will be ignored.
Constructor and description |
---|
LoaderConfiguration
() creates a new loader configuration |
Type Params | Return Type | Name and description |
---|---|---|
public void |
addClassPath(String path) Adds a classpath to this configuration. | |
public void |
addFile(File file) Adds a file to the classpath if it exists. | |
public void |
addFile(String filename) Adds a file to the classpath if it exists. | |
public void |
configure(InputStream is) configures this loader with a stream | |
public URL[] |
getClassPathUrls() The classpath as URL[] from this configuration. | |
public List<String> |
getGrabUrls() The extra grab configuration. | |
public String |
getMainClass() Returns the name of the main class for this configuration. | |
public void |
setMainClass(String classname) Sets the main class. | |
public void |
setRequireMain(boolean requireMain) Determines if a main class is required when calling. |
Methods inherited from class | Name |
---|---|
class Object | wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll |
creates a new loader configuration
Adds a classpath to this configuration. It expects a string with multiple paths, separated by the system dependent path separator. Expands wildcards, e.g. dir/* into all the jars in dir.
path
- the path as a path separator delimited stringAdds a file to the classpath if it exists.
file
- the file to addAdds a file to the classpath if it exists.
filename
- the name of the file to addconfigures this loader with a stream
is
- stream used to read the configurationThe classpath as URL[] from this configuration. This can be used to construct a class loader.
The extra grab configuration.
Returns the name of the main class for this configuration.
Sets the main class. If there is already a main class it is overwritten. Calling configure(InputStream) after calling this method does not require a main class definition inside the stream.
classname
- the name to become the main classDetermines if a main class is required when calling.
requireMain
- set to false if no main class is required
© 2003-2020 The Apache Software Foundation
Licensed under the Apache license.
https://docs.groovy-lang.org/3.0.7/html/gapi/org/codehaus/groovy/tools/LoaderConfiguration.html