|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectbsh.Primitive
Wrapper for primitive types in Bsh. This is package public because it is used in the implementation of some bsh commands. See the note in LHS.java about wrapping objects.
| Field Summary | |
static Primitive |
NULL
|
(package private) static java.util.Hashtable |
primitiveToWrapper
|
static Primitive |
VOID
VOID means "no type". |
(package private) static java.util.Hashtable |
wrapperToPrimitive
|
| Constructor Summary | |
Primitive(boolean value)
|
|
Primitive(byte value)
|
|
Primitive(char value)
|
|
Primitive(double value)
|
|
Primitive(float value)
|
|
Primitive(int value)
|
|
Primitive(long value)
|
|
Primitive(java.lang.Object value)
|
|
Primitive(short value)
|
|
| Method Summary | |
static java.lang.Object |
binaryOperation(java.lang.Object obj1,
java.lang.Object obj2,
int kind)
Perform a binary operation on two Primitives or wrapper types. |
(package private) static java.lang.Object |
binaryOperationImpl(java.lang.Object lhs,
java.lang.Object rhs,
int kind)
|
(package private) static java.lang.Boolean |
booleanBinaryOperation(java.lang.Boolean B1,
java.lang.Boolean B2,
int kind)
|
(package private) static boolean |
booleanUnaryOperation(java.lang.Boolean B,
int kind)
|
boolean |
booleanValue()
|
static java.lang.Class |
boxType(java.lang.Class primitiveType)
Get the corresponding java.lang wrapper class for the primitive TYPE class. |
(package private) static Primitive |
castPrimitive(java.lang.Class toType,
java.lang.Class fromType,
Primitive fromValue,
boolean checkOnly,
int operation)
|
Primitive |
castToType(java.lang.Class toType,
int operation)
Cast this bsh.Primitive value to a new bsh.Primitive value This is usually a numeric type cast. |
(package private) static java.lang.Object |
castWrapper(java.lang.Class toType,
java.lang.Object value)
Cast a primitive value represented by its java.lang wrapper type to the specified java.lang wrapper type. |
(package private) static java.lang.Object |
doubleBinaryOperation(java.lang.Double D1,
java.lang.Double D2,
int kind)
|
(package private) static double |
doubleUnaryOperation(java.lang.Double D,
int kind)
|
boolean |
equals(java.lang.Object obj)
Primitives compare equal with other Primitives containing an equal wrapped value. |
(package private) static java.lang.Object |
floatBinaryOperation(java.lang.Float F1,
java.lang.Float F2,
int kind)
|
(package private) static float |
floatUnaryOperation(java.lang.Float F,
int kind)
|
static Primitive |
getDefaultValue(java.lang.Class type)
Get the appropriate default value per JLS 4.5.4 |
java.lang.Class |
getType()
Get the corresponding Java primitive TYPE class for this Primitive. |
java.lang.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. |
(package private) static java.lang.Object |
intBinaryOperation(java.lang.Integer I1,
java.lang.Integer I2,
int kind)
|
(package private) static int |
intUnaryOperation(java.lang.Integer I,
int kind)
|
int |
intValue()
|
boolean |
isNumber()
Determine if this primitive is a numeric type. |
static boolean |
isWrapperType(java.lang.Class type)
|
(package private) static java.lang.Object |
longBinaryOperation(java.lang.Long L1,
java.lang.Long L2,
int kind)
|
(package private) static long |
longUnaryOperation(java.lang.Long L,
int kind)
|
java.lang.Number |
numberValue()
|
(package private) static java.lang.Object[] |
promotePrimitives(java.lang.Object lhs,
java.lang.Object rhs)
Promote the pair of primitives to the maximum type of the two. |
(package private) static java.lang.Object |
promoteToInteger(java.lang.Object wrapper)
Promote primitive wrapper type to to Integer wrapper type |
java.lang.String |
toString()
|
static Primitive |
unaryOperation(Primitive val,
int kind)
|
static java.lang.Class |
unboxType(java.lang.Class wrapperType)
Get the corresponding primitive TYPE class for the java.lang wrapper class type. |
static java.lang.Object |
unwrap(java.lang.Object obj)
Unwrap primitive values and map voids to nulls. |
static java.lang.Object[] |
unwrap(java.lang.Object[] args)
|
static java.lang.Object[] |
wrap(java.lang.Object[] args,
java.lang.Class[] paramTypes)
|
static java.lang.Object |
wrap(java.lang.Object value,
java.lang.Class type)
Wrap primitive values (as indicated by type param) and nulls in the Primitive class. |
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
static java.util.Hashtable primitiveToWrapper
static java.util.Hashtable wrapperToPrimitive
public static final Primitive NULL
public static final Primitive VOID
| Constructor Detail |
public Primitive(java.lang.Object value)
public Primitive(boolean value)
public Primitive(byte value)
public Primitive(short value)
public Primitive(char value)
public Primitive(int value)
public Primitive(long value)
public Primitive(float value)
public Primitive(double value)
| Method Detail |
public java.lang.Object getValue()
public java.lang.String toString()
public java.lang.Class getType()
public static java.lang.Object binaryOperation(java.lang.Object obj1,
java.lang.Object obj2,
int kind)
throws UtilEvalError
UtilEvalError
static java.lang.Object binaryOperationImpl(java.lang.Object lhs,
java.lang.Object rhs,
int kind)
throws UtilEvalError
UtilEvalError
static java.lang.Boolean booleanBinaryOperation(java.lang.Boolean B1,
java.lang.Boolean B2,
int kind)
throws UtilEvalError
UtilEvalError
static java.lang.Object longBinaryOperation(java.lang.Long L1,
java.lang.Long L2,
int kind)
static java.lang.Object intBinaryOperation(java.lang.Integer I1,
java.lang.Integer I2,
int kind)
static java.lang.Object doubleBinaryOperation(java.lang.Double D1,
java.lang.Double D2,
int kind)
throws UtilEvalError
UtilEvalError
static java.lang.Object floatBinaryOperation(java.lang.Float F1,
java.lang.Float F2,
int kind)
throws UtilEvalError
UtilEvalErrorstatic java.lang.Object promoteToInteger(java.lang.Object wrapper)
static java.lang.Object[] promotePrimitives(java.lang.Object lhs,
java.lang.Object rhs)
public static Primitive unaryOperation(Primitive val,
int kind)
throws UtilEvalError
UtilEvalError
static boolean booleanUnaryOperation(java.lang.Boolean B,
int kind)
throws UtilEvalError
UtilEvalError
static int intUnaryOperation(java.lang.Integer I,
int kind)
static long longUnaryOperation(java.lang.Long L,
int kind)
static float floatUnaryOperation(java.lang.Float F,
int kind)
static double doubleUnaryOperation(java.lang.Double D,
int kind)
public int intValue()
throws UtilEvalError
UtilEvalError
public boolean booleanValue()
throws UtilEvalError
UtilEvalErrorpublic boolean isNumber()
public java.lang.Number numberValue()
throws UtilEvalError
UtilEvalErrorpublic boolean equals(java.lang.Object obj)
public int hashCode()
public static java.lang.Object unwrap(java.lang.Object obj)
obj - object type which may be bsh.Primitive
public static java.lang.Object[] unwrap(java.lang.Object[] args)
public static java.lang.Object[] wrap(java.lang.Object[] args,
java.lang.Class[] paramTypes)
public static java.lang.Object wrap(java.lang.Object value,
java.lang.Class type)
public static Primitive getDefaultValue(java.lang.Class type)
public static java.lang.Class boxType(java.lang.Class primitiveType)
public static java.lang.Class unboxType(java.lang.Class wrapperType)
public Primitive castToType(java.lang.Class toType,
int operation)
throws UtilEvalError
toType - is the java object or primitive TYPE class
UtilEvalError
static Primitive castPrimitive(java.lang.Class toType,
java.lang.Class fromType,
Primitive fromValue,
boolean checkOnly,
int operation)
throws UtilEvalError
toType - is the java primitive TYPE type of the primitive to be
cast to.fromType - is the java primitive TYPE type of the primitive to be
cast. fromType should be null to indicate that the fromValue was null
or void.fromValue - is, optionally, the value to be converted. If
checkOnly is true fromValue must be null. If checkOnly is false,
fromValue must be non-null (Primitive.NULL is of course valid).
UtilEvalErrorpublic static boolean isWrapperType(java.lang.Class type)
static java.lang.Object castWrapper(java.lang.Class toType,
java.lang.Object value)
toType - is the java TYPE typevalue - is the value in java.lang wrapper.
value may not be null.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||