|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.mortbay.util.TypeUtil
public class TypeUtil
TYPE Utilities. Provides various static utiltiy methods for manipulating types and their string representations.
| Field Summary | |
|---|---|
private static HashMap |
class2Name
|
private static HashMap |
class2Value
|
static int |
CR
|
private static int |
intCacheSize
|
private static Integer[] |
integerCache
|
private static String[] |
integerStrCache
|
static int |
LF
|
private static Integer |
minusOne
|
private static HashMap |
name2Class
|
private static Class[] |
stringArg
|
| Constructor Summary | |
|---|---|
TypeUtil()
|
|
| Method Summary | |
|---|---|
static byte |
convertHexDigit(byte b)
|
static void |
dump(Class c)
|
static void |
dump(ClassLoader cl)
|
static byte[] |
fromHexString(String s)
|
static Class |
fromName(String name)
Class from a canonical name for a type. |
static Integer |
newInteger(int i)
Convert int to Integer using cache. |
static byte[] |
parseBytes(String s,
int base)
|
static int |
parseInt(String s,
int offset,
int length,
int base)
Parse an int from a substring. |
static byte[] |
readLine(InputStream in)
|
static String |
toHexString(byte[] b)
|
static String |
toHexString(byte[] b,
int offset,
int length)
|
static String |
toName(Class type)
Canonical name for a type. |
static String |
toString(byte[] bytes,
int base)
|
static String |
toString(int i)
Convert int to String using cache. |
static Object |
valueOf(Class type,
String value)
Convert String value to instance. |
static Object |
valueOf(String type,
String value)
Convert String value to instance. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static int CR
public static int LF
private static final HashMap name2Class
private static final HashMap class2Name
private static final HashMap class2Value
private static Class[] stringArg
private static int intCacheSize
private static Integer[] integerCache
private static String[] integerStrCache
private static Integer minusOne
| Constructor Detail |
|---|
public TypeUtil()
| Method Detail |
|---|
public static Class fromName(String name)
name - A class or type name.
public static String toName(Class type)
type - A class , which may be a primitive TYPE field.
public static Object valueOf(Class type,
String value)
type - The class of the instance, which may be a primitive TYPE field.value - The value as a string.
public static Object valueOf(String type,
String value)
type - classname or type (eg int)value - The value as a string.
public static Integer newInteger(int i)
public static String toString(int i)
public static int parseInt(String s,
int offset,
int length,
int base)
throws NumberFormatException
s - Stringoffset - Offset within stringlength - Length of integer or -1 for remainder of stringbase - base of the integer
NumberFormatException
public static byte[] parseBytes(String s,
int base)
public static String toString(byte[] bytes,
int base)
public static byte convertHexDigit(byte b)
b - An ASCII encoded character 0-9 a-f A-F
public static String toHexString(byte[] b)
public static String toHexString(byte[] b,
int offset,
int length)
public static byte[] fromHexString(String s)
public static void dump(Class c)
public static void dump(ClassLoader cl)
public static byte[] readLine(InputStream in)
throws IOException
IOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||