Add LValue.toJavaX and VM.pushboxedx() functions for all java basic type conversions

This commit is contained in:
James Roseborough
2007-10-18 17:47:01 +00:00
parent ccde158514
commit 8e2ff119f9
23 changed files with 344 additions and 66 deletions

View File

@@ -22,4 +22,40 @@ public class LNumber extends LValue {
* override.
*/
public abstract boolean isInteger();
/** Convert to a Byte value */
public Byte toJavaBoxedByte() {
return new Byte(toJavaByte());
}
/** Convert to a boxed Character value */
public Character toJavaBoxedCharacter() {
return new Character(toJavaChar());
}
/** Convert to a boxed Double value */
public Double toJavaBoxedDouble() {
return new Double(toJavaDouble());
}
/** Convert to a boxed Float value */
public Float toJavaBoxedFloat() {
return new Float(toJavaFloat());
}
/** Convert to a boxed Integer value */
public Integer toJavaBoxedInteger() {
return new Integer(toJavaInt());
}
/** Convert to a boxed Long value */
public Long toJavaBoxedLong() {
return new Long(toJavaLong());
}
/** Convert to a boxed Short value */
public Short toJavaBoxedShort() {
return new Short(toJavaShort());
}
}