Class BaseClassLoaderTag

java.lang.Object
org.apache.commons.jelly.TagSupport
org.apache.commons.jelly.tags.core.BaseClassLoaderTag
All Implemented Interfaces:
Tag
Direct Known Subclasses:
ArgTag, NewTag

public abstract class BaseClassLoaderTag extends TagSupport
Abstract base tag providing ClassLoader support.
Version:
$Revision: 155420 $
Author:
James Strachan, Rodney Waldhoff
  • Field Details

    • 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 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.
  • Constructor Details

    • BaseClassLoaderTag

      public BaseClassLoaderTag()
  • Method Details

    • 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.
    • 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, 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:
      use - determines whether to use JellyContext ClassLoader.