## org.apache.commons.jelly.tags.core
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 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`.

Fields inherited from class org.apache.commons.jelly.TagSupport
`body, context, hasTrimmed, parent, shouldTrim`

Constructor Summary
`BaseClassLoaderTag()`

Method Summary
`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` `setUseContextClassLoader(boolean use)` Determine whether to use the Context ClassLoader (the one found by calling `Thread.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`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Methods inherited from interface org.apache.commons.jelly.Tag
`doTag`

Field Detail

### 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`.

Constructor Detail

### BaseClassLoaderTag

    public BaseClassLoaderTag()

Method Detail

### 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.

Copyright © 2002-2005 Apache Software Foundation. All Rights Reserved.