|
||||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jacorb.util.ObjectUtil
Constructor Summary | |
---|---|
ObjectUtil()
|
Method Summary | |
---|---|
static java.util.Properties |
argsToProps(java.lang.String[] args)
Convenience method to parse an argument vector (typically from the command line) and sets any arguments of the form "-Dy=x" as values in a properties object. |
static java.lang.String |
bufToString(byte[] bs,
int start,
int len)
|
static java.lang.Class |
classForName(java.lang.String name)
Returns the Class object for the class or interface
with the given string name. |
static java.util.Map |
createIdentityHashMap()
Creates an IdentityHashMap, using either the JDK 1.4 class or JacORB's drop-in replacement class if the former is not available. |
static java.lang.String |
readURL(java.lang.String url)
|
static char |
toAscii(byte b)
|
static java.lang.String |
toHex(byte b)
toHex converts a byte into a readable string. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public ObjectUtil()
Method Detail |
public static final java.lang.String readURL(java.lang.String url) throws java.io.IOException
java.io.IOException
public static java.lang.Class classForName(java.lang.String name) throws java.lang.ClassNotFoundException, java.lang.IllegalArgumentException
Class
object for the class or interface
with the given string name. This method is a replacement for
Class.forName(String name)
. Unlike
Class.forName(String name)
(which always uses the
caller's loader or one of its ancestors), classForName
uses a thread-specific loader that has no delegation relationship
with the caller's loader. It attempts the load the desired class
with the thread-specific context class loader and falls back to
Class.forName(String name)
only if the context class
loader cannot load the class.
Loading a class with a loader that is not necessarily an ancestor
of the caller's loader is a crucial thing in many scenarios. As an
example, assume that JacORB was loaded by the boot class loader,
and suppose that some code in JacORB contains a call
Class.forName(someUserClass)
. Such usage of
Class.forName
effectively forces the user to place
someUserClass
in the boot class path. If
classForName(someUserClass)
were used instead, the user
class would be loaded by the context class loader, which by default
is set to the system (CLASSPATH) classloader.
In this simple example above, the default setting of the context class loader allows classes in the boot classpath to reach classes in the system classpath. In other scenarios, the context class loader might be different from the system classloader. Middleware systems like servlet containers or EJB containers set the context class loader so that a given thread can reach user-provided classes that are not in the system classpath.
For maximum flexibility, classForName
should replace
Class.forName(String name)
in nearly all cases.
name
- the fully qualified name of a class
java.lang.IllegalArgumentException
- if name
is null
java.lang.ClassNotFoundException
- if the named class cannot be found
java.lang.LinkageError
- if the linkage fails
java.lang.ExceptionInInitializerError
- if the class initialization failspublic static java.util.Map createIdentityHashMap()
public static java.lang.String bufToString(byte[] bs, int start, int len)
public static final java.lang.String toHex(byte b)
toHex
converts a byte into a readable string.
b
- a byte
value
String
valuepublic static final char toAscii(byte b)
public static java.util.Properties argsToProps(java.lang.String[] args)
|
||||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |