Class BaseClassLoaderTag
- java.lang.Object
-
- org.apache.commons.jelly.TagSupport
-
- org.apache.commons.jelly.tags.core.BaseClassLoaderTag
-
- All Implemented Interfaces:
Tag
public abstract class BaseClassLoaderTag extends TagSupport
Abstract base tag providingClassLoader
support.- Version:
- $Revision: 155420 $
- Author:
- James Strachan, Rodney Waldhoff
-
-
Field Summary
Fields Modifier and Type Field Description protected 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 isfalse
.-
Fields inherited from class org.apache.commons.jelly.TagSupport
body, context, parent
-
-
Constructor Summary
Constructors Constructor Description BaseClassLoaderTag()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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(ClassLoader classLoader)
Set the class loader to be used for instantiating application objects when required.void
setUseContextClassLoader(boolean use)
Determine whether to use the Context ClassLoader (the one found by callingThread.currentThread().getContextClassLoader()
) to resolve/load classes.-
Methods inherited from class org.apache.commons.jelly.TagSupport
findAncestorWithClass, findAncestorWithClass, findAncestorWithClass, findAncestorWithClass, findAncestorWithClass, findAncestorWithClass, getBody, getBodyText, getBodyText, getContext, getParent, invokeBody, isEscapeText, isTrim, setBody, setContext, setEscapeText, setParent, setTrim, trimBody
-
-
-
-
Field Detail
-
classLoader
protected 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 theuseContextClassLoader
variable.
-
useContextClassLoader
protected boolean useContextClassLoader
Do we want to use the Context ClassLoader when loading classes for instantiating new objects? Default isfalse
.
-
-
Method Detail
-
getClassLoader
public 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.
- The class loader set by
-
setClassLoader
public void setClassLoader(ClassLoader classLoader)
Set the class loader to be used for instantiating application objects when required.- Parameters:
classLoader
- The new class loader to use, ornull
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 callingThread.currentThread().getContextClassLoader()
) to resolve/load classes. If not using Context ClassLoader, then the class-loading defaults to using the calling-class' ClassLoader.- Parameters:
use
- determines whether to use JellyContext ClassLoader.
-
-