org.jfree.util
public final class ObjectUtilities extends Object
Field Summary | |
---|---|
static String | CLASS_CONTEXT
A constant for using the ClassContext as source for the classloader. |
static String | THREAD_CONTEXT
A constant for using the TheadContext as source for the classloader. |
Method Summary | |
---|---|
static Object | clone(Object object)
Returns a clone of the specified object, if it can be cloned, otherwise
throws a CloneNotSupportedException.
|
static Collection | deepClone(Collection collection)
Returns a new collection containing clones of all the items in the
specified collection.
|
static boolean | equal(Object o1, Object o2)
Returns true if the two objects are equal OR both
null .
|
static ClassLoader | getClassLoader()
Returns the custom classloader or null, if no custom classloader is defined.
|
static ClassLoader | getClassLoader(Class c)
Returns the classloader, which was responsible for loading the given
class.
|
static String | getClassLoaderSource()
Returns the internal configuration entry, whether the classloader of
the thread context or the context classloader should be used.
|
static URL | getResource(String name, Class c)
Returns the resource specified by the absolute name.
|
static InputStream | getResourceAsStream(String name, Class context)
Returns the inputstream for the resource specified by the
absolute name.
|
static URL | getResourceRelative(String name, Class c)
Returns the resource specified by the relative name.
|
static InputStream | getResourceRelativeAsStream(String name, Class context)
Returns the inputstream for the resource specified by the
relative name.
|
static int | hashCode(Object object)
Returns a hash code for an object, or zero if the object is
null .
|
static boolean | isJDK14() |
static Object | loadAndInstantiate(String className, Class source)
Tries to create a new instance of the given class. |
static Object | loadAndInstantiate(String className, Class source, Class type)
Tries to create a new instance of the given class. |
static void | setClassLoader(ClassLoader classLoader)
Redefines the custom classloader.
|
static void | setClassLoaderSource(String classLoaderSource)
Defines the internal configuration entry, whether the classloader of
the thread context or the context classloader should be used.
|
Parameters: object the object to clone (null
not permitted).
Returns: A clone of the specified object.
Throws: CloneNotSupportedException if the object cannot be cloned.
Parameters: collection the collection (null
not permitted).
Returns: A new collection containing clones of all the items in the specified collection.
Throws: CloneNotSupportedException if any of the items in the collection cannot be cloned.
true
if the two objects are equal OR both
null
.
Parameters: o1 object 1 (null
permitted). o2 object 2 (null
permitted).
Returns: true
or false
.
Returns: the custom classloader or null to use the default.
Parameters: c the classloader, either an application class loader or the boot loader.
Returns: the classloader, never null.
Throws: SecurityException if the SecurityManager does not allow to grab the context classloader.
Returns: the classloader source, either THREAD_CONTEXT or CLASS_CONTEXT.
Parameters: name the name of the resource c the source class
Returns: the url of the resource or null, if not found.
Parameters: name the name of the resource context the source class
Returns: the url of the resource or null, if not found.
Parameters: name the name of the resource relative to the given class c the source class
Returns: the url of the resource or null, if not found.
Parameters: name the name of the resource relative to the given class context the source class
Returns: the url of the resource or null, if not found.
null
.
Parameters: object the object (null
permitted).
Returns: The object's hash code (or zero if the object is
null
).
Parameters: className the class name as String, never null. source the source class, from where to get the classloader.
Returns: the instantiated object or null, if an error occured.
Parameters: className the class name as String, never null. source the source class, from where to get the classloader.
Returns: the instantiated object or null, if an error occured.
Parameters: classLoader the new classloader or null to use the default.
Parameters: classLoaderSource the classloader source, either THREAD_CONTEXT or CLASS_CONTEXT.