001package org.kuali.coeus.s2sgen.impl.util; 002 003public final class ClassLoaderUtils { 004 005 private ClassLoaderUtils() { 006 throw new UnsupportedOperationException("do not call"); 007 } 008 009 /** 010 * Returns the default class loader within the current context. If there is a context classloader 011 * it is returned, otherwise the classloader which loaded the ClassLoaderUtil Class is returned. 012 * 013 * @return the appropriate default classloader which is guaranteed to be non-null 014 */ 015 public static ClassLoader getDefaultClassLoader() { 016 ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); 017 if (classLoader == null) { 018 classLoader = ClassLoaderUtils.class.getClassLoader(); 019 } 020 return classLoader; 021 } 022}