|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | ENUM CONSTANTS | FIELD | METHOD | DETAIL: ENUM CONSTANTS | FIELD | METHOD | |||||||||
java.lang.Objectjava.lang.Enum<Primitive>
org.dellroad.stuff.java.Primitive
public enum Primitive
Simple utility enumeration for working Java Class instances representing primitive types.
Instances of this class represent one of the eight Java primitive types.
| Enum Constant Summary | |
|---|---|
BOOLEAN
|
|
BYTE
|
|
CHARACTER
|
|
DOUBLE
|
|
FLOAT
|
|
INTEGER
|
|
LONG
|
|
SHORT
|
|
| Method Summary | ||
|---|---|---|
static Primitive |
get(Class<?> c)
Get the value corresponding to the given Java primitive or primitive wrapper type. |
|
char |
getLetter()
Get the single character descriptor for this primitive type, e.g., "I". |
|
String |
getLongName()
Get the long name for this primitive type, e.g., "Integer". |
|
String |
getName()
Get the short name for this primitive type, e.g., "int". |
|
Class<?> |
getType()
Get the Class object representing this primitive type, e.g., Integer.TYPE. |
|
Method |
getUnwrapMethod()
Get the wrapper class' "unwrap" method for this primitive type, e.g., Integer.intValue(). |
|
Class<?> |
getWrapperType()
Get the wrapper Class object for this primitive type, e.g., Integer.class. |
|
Object |
parseValue(String string)
Parse a string value using the type's valueOf method. |
|
static Primitive |
valueOf(String name)
Returns the enum constant of this type with the specified name. |
|
static Primitive[] |
values()
Returns an array containing the constants of this enum type, in the order they are declared. |
|
abstract
|
visit(PrimitiveSwitch<R> pswitch)
|
|
| Methods inherited from class java.lang.Enum |
|---|
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf |
| Methods inherited from class java.lang.Object |
|---|
getClass, notify, notifyAll, wait, wait, wait |
| Enum Constant Detail |
|---|
public static final Primitive BOOLEAN
public static final Primitive BYTE
public static final Primitive CHARACTER
public static final Primitive SHORT
public static final Primitive INTEGER
public static final Primitive FLOAT
public static final Primitive LONG
public static final Primitive DOUBLE
| Method Detail |
|---|
public static Primitive[] values()
for (Primitive c : Primitive.values()) System.out.println(c);
public static Primitive valueOf(String name)
name - the name of the enum constant to be returned.
IllegalArgumentException - if this enum type has no constant
with the specified name
NullPointerException - if the argument is nullpublic abstract <R> R visit(PrimitiveSwitch<R> pswitch)
public String getName()
public String getLongName()
public char getLetter()
public Class<?> getType()
Class object representing this primitive type, e.g., Integer.TYPE.
public Class<?> getWrapperType()
Class object for this primitive type, e.g., Integer.class.
public Method getUnwrapMethod()
Integer.intValue().
public Object parseValue(String string)
valueOf method.
string - string representation of a value
IllegalArgumentException - if string cannot be parsed
IllegalArgumentException - if string is nullpublic static Primitive get(Class<?> c)
Primitive corresponding to c, or null
if c is not a primitive or primitive wrapper type
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | ENUM CONSTANTS | FIELD | METHOD | DETAIL: ENUM CONSTANTS | FIELD | METHOD | |||||||||