public class DefaultClassLoaderStrategy extends java.lang.Object implements ClassLoaderStrategy
Class.forName
.
Class will be loaded using class loaders in the following order:
Thread.currentThread().getContextClassLoader()}
ClassLoaderStrategy.Implementation
Modifier and Type | Field and Description |
---|---|
protected boolean |
loadArrayClassByComponentTypes |
static char[] |
PRIMITIVE_BYTECODE_NAME
List of primitive bytecode characters that matches names list.
|
static java.lang.String[] |
PRIMITIVE_TYPE_NAMES
List of primitive type names.
|
static java.lang.Class[] |
PRIMITIVE_TYPES
List of primitive types that matches names list.
|
Constructor and Description |
---|
DefaultClassLoaderStrategy() |
Modifier and Type | Method and Description |
---|---|
boolean |
isLoadArrayClassByComponentTypes()
Returns arrays class loading strategy.
|
protected java.lang.Class |
loadArrayClassByComponentType(java.lang.String className,
java.lang.ClassLoader classLoader)
Loads array class using component type.
|
java.lang.Class |
loadClass(java.lang.String className,
java.lang.ClassLoader classLoader)
Loads class by name.
|
protected java.lang.Class |
loadClass(java.lang.String className,
java.lang.String arrayClassName,
java.lang.ClassLoader classLoader)
Loads a class using provided class loader.
|
static java.lang.String |
prepareArrayClassnameForLoading(java.lang.String className)
Prepares classname for loading, respecting the arrays.
|
void |
setLoadArrayClassByComponentTypes(boolean loadArrayClassByComponentTypes)
Defines arrays class loading strategy.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
get
public static final java.lang.String[] PRIMITIVE_TYPE_NAMES
public static final java.lang.Class[] PRIMITIVE_TYPES
public static final char[] PRIMITIVE_BYTECODE_NAME
protected boolean loadArrayClassByComponentTypes
public boolean isLoadArrayClassByComponentTypes()
public void setLoadArrayClassByComponentTypes(boolean loadArrayClassByComponentTypes)
false
(default), classes will be loaded by Class.forName
.
If true
, classes will be loaded by reflection and component types.public static java.lang.String prepareArrayClassnameForLoading(java.lang.String className)
null
if class name is not an array.public java.lang.Class loadClass(java.lang.String className, java.lang.ClassLoader classLoader) throws java.lang.ClassNotFoundException
loadClass
in interface ClassLoaderStrategy
java.lang.ClassNotFoundException
protected java.lang.Class loadClass(java.lang.String className, java.lang.String arrayClassName, java.lang.ClassLoader classLoader)
Class.forName
!
We must use this since for JDK >= 6 arrays will be not loaded using classloader,
but only with forName
method. However, array loading strategy can be
changed
.protected java.lang.Class loadArrayClassByComponentType(java.lang.String className, java.lang.ClassLoader classLoader) throws java.lang.ClassNotFoundException
java.lang.ClassNotFoundException
Copyright © 2003-present Jodd Team