Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 /*
  * Copyright 2002,2004 The Apache Software Foundation.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
  *
  *      http://www.apache.org/licenses/LICENSE-2.0
  *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.apache.commons.jelly.tags.core;
Abstract base tag providing java.lang.ClassLoader support.

Author(s):
James Strachan
Rodney Waldhoff
Version:
$Revision: 155420 $
public abstract class BaseClassLoaderTag extends TagSupport {
    
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.
    protected ClassLoader classLoader = null;

    
Do we want to use the Context ClassLoader when loading classes for instantiating new objects? Default is false.
    protected boolean useContextClassLoader = false;

    
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.
    public ClassLoader getClassLoader() {
        return ClassLoaderUtils.getClassLoader(getClass());
    }

    
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
    public void setClassLoader(ClassLoader classLoader) {
        this. = classLoader;
    }

    
Return the boolean as to whether the context classloader should be used.
    public boolean getUseContextClassLoader() {
        return ;
    }

    
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.
    public void setUseContextClassLoader(boolean use) {
         = use;
    }
New to GrepCode? Check out our FAQ X