bsh
public class Primitive extends Object implements ParserConstants, Serializable
Field Summary | |
---|---|
static Primitive | NULL |
static Primitive | VOID
VOID means "no type".
|
Constructor Summary | |
---|---|
Primitive(Number number) | |
Primitive(Boolean value) | |
Primitive(Byte value) | |
Primitive(Short value) | |
Primitive(Character value) | |
Primitive(Integer value) | |
Primitive(Long value) | |
Primitive(Float value) | |
Primitive(Double value) | |
Primitive(boolean value) | |
Primitive(byte value) | |
Primitive(short value) | |
Primitive(char value) | |
Primitive(int value) | |
Primitive(long value) | |
Primitive(float value) | |
Primitive(double value) |
Method Summary | |
---|---|
static Object | binaryOperation(Object obj1, Object obj2, int kind)
Perform a binary operation on two Primitives or wrapper types.
|
boolean | booleanValue() |
boolean | equals(Object obj)
Primitives compare equal with other Primitives containing an equal
wrapped value. |
static Primitive | getDefaultValue(Class type)
Get the appropriate default value per JLS 4.5.4 |
Class | getType()
Get the corresponding primitive TYPE class for the Primitive |
Object | getValue()
Return the primitive value stored in its java.lang wrapper class |
int | hashCode()
The hash of the Primitive is tied to the hash of the wrapped value but
shifted so that they are not the same. |
int | intValue() |
boolean | isNumber()
Determine if this primitive is a numeric type.
i.e. not boolean, null, or void (but including char) |
Number | numberValue() |
String | toString() |
static Primitive | unaryOperation(Primitive val, int kind) |
static Object | unwrap(Object obj)
Unwrap primitive values and map voids to nulls.
|
Returns: the primitive TYPE class type of the value or Void.TYPE for Primitive.VOID or null value for type of Primitive.NULL
Parameters: obj object type which may be bsh.Primitive
Returns: corresponding "normal" Java type, "unwrapping" any bsh.Primitive types to their wrapper types.