org.thymeleaf.util
Class ClassLoaderUtils

Object
  extended by org.thymeleaf.util.ClassLoaderUtils

public final class ClassLoaderUtils
extends Object

Utility class for obtaining a correct classloader on which to operate from a specific class.

Since:
2.0.6
Author:
Daniel Fernández

Method Summary
static ClassLoader getClassLoader(Class<?> clazz)
           Try to obtain a classloader, following these priorities: If there is a thread context class loader, return it.
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getClassLoader

public static ClassLoader getClassLoader(Class<?> clazz)

Try to obtain a classloader, following these priorities:

  1. If there is a thread context class loader, return it.
  2. Else if there is a class loader related to the class passed as argument, return it.
  3. Else return the system class loader.

Parameters:
clazz - the class which loader will be obtained in the second step. Can be null (that will skip that second step).
Returns:
a non-null, safe classloader to use.


Copyright © 2013 The THYMELEAF team. All Rights Reserved.