Attributes and methods |
.classesFolder : String
Returns the full file path of the folder where the specific classes are searched by the loader
Since : 2.0.5
|
.libFolder : String
Returns the full file path of the folder where the specific libraries (jar) are searched by the loader
Since : 3.0.0
|
.loadClass(String javaClassName) : Class>
Loads the given java class and return it (no instance created).
It can be a standard Java class (class of the JDK) or a specific class.
The specific classes must be located in the 'classes' folder (in the templates bundle)
or in a jar located in the 'lib' folder (in the templates bundle)
Parameters :
javaClassName : the name of the Java class to be loaded
Example :
## load the class and put an instance in the context
#set( $Math = $loader.loadClass("java.lang.Math")
## use the static methods of this class
$Math.random()
Since : 2.1.0
|
.newInstance(String javaClassName) : Object
Loads the given java class, creates a new instance and return it
It can be a standard Java class (class of the JDK) or a specific class.
The specific classes must be located in the 'classes' folder (in the templates bundle)
or in a jar located in the 'lib' folder (in the templates bundle)
NB : The Java class must have a default constructor (in order to be created by 'javaClass.newInstance()'
Parameters :
javaClassName : the name of the Java class to be loaded and used to create the instance
Example :
## create an instance of StringBuilder and put it in the context with #set
#set( $strBuilder = $loader.newInstance('java.lang.StringBuilder') )
## use the instance
$strBuilder.append('aa')
## create new instance of a specific class
#set( $tool = $loader.newInstance('MyTool') )
Since : 2.1.0
|
.uRLs : URL[]
Returns an array containing all the URLs used by the class loader
Since : 3.0.0
|