public class ClassDescription extends Object
A helper class for defining references to classes.
Handling of classes can become quite complex because of issues with different class loaders. Because of that the dependency injection framework supports multiple ways of defining classes:
Class
objects; this can be used
when the class is already known at compile timeBeanContext
Instances of this class encapsulate the different ways of specifying a class.
They can be initialized with different variants of class descriptions. The
getTargetClass()
method can be used for obtaining a reference
to the wrapped class. Instances are thread-safe and can be shared between
multiple components. New instances are created using the static factory
methods.
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj)
Tests the passed in object for equality.
|
String |
getClassLoaderName()
Returns the symbolic name of the class loader for resolving the class.
|
static ClassDescription |
getInstance(Class<?> cls)
Returns an instance for the specified class.
|
static ClassDescription |
getInstance(String clsName)
Returns an instance for the specified class name that will be resolved
using the default class loader.
|
static ClassDescription |
getInstance(String clsName,
String clsLoaderName)
Returns an instance for the specified class name and class loader name.
|
Class<?> |
getTargetClass(ClassLoaderProvider clProvider)
Returns the target class of this description.
|
String |
getTargetClassName()
Returns the name of the target class of this description.
|
int |
hashCode()
Returns a hash code for this object.
|
String |
toString()
Returns a string representation of this object.
|
public Class<?> getTargetClass(ClassLoaderProvider clProvider)
ClassLoaderProvider
is used for resolving the class if necessary.
This implementation will cache the Class
objects when they
have been resolved.clProvider
- the ClassLoaderProvider
InjectionException
- if the class cannot be
resolvedIllegalArgumentException
- if the ClassLoaderProvider
is
needed, but is nullpublic String getTargetClassName()
public String getClassLoaderName()
public boolean equals(Object obj)
public int hashCode()
public String toString()
public static ClassDescription getInstance(Class<?> cls)
cls
- the target classpublic static ClassDescription getInstance(String clsName, String clsLoaderName)
clsName
- the name of the classclsLoaderName
- the symbolic name of the class loaderpublic static ClassDescription getInstance(String clsName)
clsName
- the name of the classCopyright © 2016 The JGUIraffe Team. All rights reserved.