|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.pentaho.reporting.libraries.base.util.ObjectUtilities
public final class ObjectUtilities
A collection of useful static utility methods for handling classes and object instantiation.
| Field Summary | |
|---|---|
static java.lang.String |
CLASS_CONTEXT
A constant for using the ClassContext as source for the classloader. |
static java.lang.String |
THREAD_CONTEXT
A constant for using the TheadContext as source for the classloader. |
| Method Summary | |
|---|---|
static java.lang.Object |
clone(java.lang.Object object)
Returns a clone of the specified object, if it can be cloned, otherwise throws a CloneNotSupportedException. |
static boolean |
equal(java.lang.Object o1,
java.lang.Object o2)
Returns true if the two objects are equal OR both null. |
static boolean |
equalArray(java.lang.Object[] array1,
java.lang.Object[] array2)
Compares two arrays and determines if they are equal. |
static java.lang.ClassLoader |
getClassLoader()
Returns the custom classloader or null, if no custom classloader is defined. |
static java.lang.ClassLoader |
getClassLoader(java.lang.Class c)
Returns the classloader, which was responsible for loading the given class. |
static java.lang.String |
getClassLoaderSource()
Returns the internal configuration entry, whether the classloader of the thread context or the context classloader should be used. |
static java.net.URL |
getResource(java.lang.String name,
java.lang.Class c)
Returns the resource specified by the absolute name. |
static java.io.InputStream |
getResourceAsStream(java.lang.String name,
java.lang.Class context)
Returns the inputstream for the resource specified by the absolute name. |
static java.net.URL |
getResourceRelative(java.lang.String name,
java.lang.Class c)
Returns the resource specified by the relative name. |
static java.io.InputStream |
getResourceRelativeAsStream(java.lang.String name,
java.lang.Class context)
Returns the inputstream for the resource specified by the relative name. |
static boolean |
isJDK14()
Checks whether the current JDK is at least JDK 1.4. |
static java.lang.Object |
loadAndInstantiate(java.lang.String className,
java.lang.Class source)
Deprecated. This class is not typesafe and instantiates the specified object without any additional checks. |
static java.lang.Object |
loadAndInstantiate(java.lang.String className,
java.lang.Class source,
java.lang.Class type)
Tries to create a new instance of the given class. |
static void |
setClassLoader(java.lang.ClassLoader classLoader)
Redefines the custom classloader. |
static void |
setClassLoaderSource(java.lang.String classLoaderSource)
Defines the internal configuration entry, whether the classloader of the thread context or the context classloader should be used. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String THREAD_CONTEXT
public static final java.lang.String CLASS_CONTEXT
| Method Detail |
|---|
public static java.lang.String getClassLoaderSource()
public static void setClassLoaderSource(java.lang.String classLoaderSource)
classLoaderSource - the classloader source, either THREAD_CONTEXT or CLASS_CONTEXT.
public static boolean equal(java.lang.Object o1,
java.lang.Object o2)
true if the two objects are equal OR both null.
o1 - object 1 (null permitted).o2 - object 2 (null permitted).
true or false.
public static java.lang.Object clone(java.lang.Object object)
throws java.lang.CloneNotSupportedException
object - the object to clone (null not permitted).
java.lang.CloneNotSupportedException - if the object cannot be cloned.public static void setClassLoader(java.lang.ClassLoader classLoader)
classLoader - the new classloader or null to use the default.public static java.lang.ClassLoader getClassLoader()
public static java.lang.ClassLoader getClassLoader(java.lang.Class c)
c - the classloader, either an application class loader or the boot loader.
java.lang.SecurityException - if the SecurityManager does not allow to grab the context classloader.
public static java.net.URL getResource(java.lang.String name,
java.lang.Class c)
name - the name of the resourcec - the source class
public static java.net.URL getResourceRelative(java.lang.String name,
java.lang.Class c)
name - the name of the resource relative to the given classc - the source class
public static java.io.InputStream getResourceAsStream(java.lang.String name,
java.lang.Class context)
name - the name of the resourcecontext - the source class
public static java.io.InputStream getResourceRelativeAsStream(java.lang.String name,
java.lang.Class context)
name - the name of the resource relative to the given classcontext - the source class
public static java.lang.Object loadAndInstantiate(java.lang.String className,
java.lang.Class source)
className - the class name as String, never null.source - the source class, from where to get the classloader.
public static java.lang.Object loadAndInstantiate(java.lang.String className,
java.lang.Class source,
java.lang.Class type)
className - the class name as String, never null.source - the source class, from where to get the classloader.type - the expected type of the object that is being instantiated.
public static boolean isJDK14()
public static boolean equalArray(java.lang.Object[] array1,
java.lang.Object[] array2)
null null
references for any of the arrays.
array1 - the first array to compare.array2 - the second array to compare.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||