org.apache.commons.jelly.tags.core
Class NewTag
java.lang.Object
|
+--org.apache.commons.jelly.TagSupport
|
+--org.apache.commons.jelly.tags.core.NewTag
- All Implemented Interfaces:
- Tag
- public class NewTag
- extends TagSupport
A tag which creates a new object of the given type
- Version:
- $Revision: 1.3 $
- Author:
- James Strachan
Field Summary |
protected java.lang.ClassLoader |
classLoader
The class loader to use for instantiating application objects. |
protected boolean |
useContextClassLoader
Do we want to use the Context ClassLoader when loading classes
for instantiating new objects? Default is false . |
Method Summary |
void |
doTag(XMLOutput output)
Evaluates this tag after all the tags properties have been initialized. |
java.lang.ClassLoader |
getClassLoader()
Return the class loader to be used for instantiating application objects
when required. |
boolean |
getUseContextClassLoader()
Return the boolean as to whether the context classloader should be used. |
void |
setClassLoader(java.lang.ClassLoader classLoader)
Set the class loader to be used for instantiating application objects
when required. |
void |
setClassName(java.lang.String className)
Sets the class name of the object to instantiate |
void |
setUseContextClassLoader(boolean use)
Determine whether to use the Context ClassLoader (the one found by
calling Thread.currentThread().getContextClassLoader() )
to resolve/load classes. |
void |
setVar(java.lang.String var)
Sets the name of the variable exported by this tag |
Methods inherited from class org.apache.commons.jelly.TagSupport |
findAncestorWithClass, findAncestorWithClass, getBody, getBodyText, getContext, getParent, invokeBody, isTrim, setBody, setContext, setParent, setTrim, trimBody |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
classLoader
protected java.lang.ClassLoader classLoader
- The class loader to use for instantiating application objects.
If not specified, the context class loader, or the class loader
used to load XMLParser itself, is used, based on the value of the
useContextClassLoader
variable.
useContextClassLoader
protected boolean useContextClassLoader
- Do we want to use the Context ClassLoader when loading classes
for instantiating new objects? Default is
false
.
NewTag
public NewTag()
setVar
public void setVar(java.lang.String var)
- Sets the name of the variable exported by this tag
setClassName
public void setClassName(java.lang.String className)
- Sets the class name of the object to instantiate
getClassLoader
public java.lang.ClassLoader getClassLoader()
- Return the class loader to be used for instantiating application objects
when required. This is determined based upon the following rules:
- The class loader set by
setClassLoader()
, if any
- The thread context class loader, if it exists and the
useContextClassLoader
property is set to true
- The class loader used to load the XMLParser class itself.
setClassLoader
public void setClassLoader(java.lang.ClassLoader classLoader)
- Set the class loader to be used for instantiating application objects
when required.
- Parameters:
classLoader
- The new class loader to use, or null
to revert to the standard rules
getUseContextClassLoader
public boolean getUseContextClassLoader()
- Return the boolean as to whether the context classloader should be used.
setUseContextClassLoader
public void setUseContextClassLoader(boolean use)
- Determine whether to use the Context ClassLoader (the one found by
calling
Thread.currentThread().getContextClassLoader()
)
to resolve/load classes. If not
using Context ClassLoader, then the class-loading defaults to
using the calling-class' ClassLoader.
- Parameters:
boolean
- determines whether to use JellyContext ClassLoader.
doTag
public void doTag(XMLOutput output)
throws java.lang.Exception
- Description copied from interface:
Tag
- Evaluates this tag after all the tags properties have been initialized.
Copyright © 2002-2002 Apache Software Foundation. All Rights Reserved.