public class JSNumber extends JSPrimitive<java.lang.Double>
Modifier and Type | Method and Description |
---|---|
JSNumber |
asNumber()
Casts the current JavaScript object to
将当前的JavaScript对象转换为JSNumber类型。 JSNumber type.
|
byte |
getByte()
Returns Byte presentation of the current number value.
返回当前数字值的字节表示形式。 |
double |
getDouble()
Returns Double presentation of the current number value.
返回当前数字值的双精度表示。 |
float |
getFloat()
Returns Float presentation of the current number value.
返回当前数字值的Float表示形式。 |
int |
getInteger()
Returns Integer presentation of the current number value.
返回当前数字值的整数表示形式。 |
long |
getLong()
Returns Long presentation of the current number value.
返回当前数字值的Long表示形式。 |
double |
getNumberValue()
Returns number value of the current JavaScript object if object represents a primitive number or Number object, otherwise throws
如果object表示原始数字或Number对象,则返回当前JavaScript对象的number值,否则抛出IllegalStateException。 IllegalStateException .
|
short |
getShort()
Returns Short presentation of the current number value.
返回当前数字值的简短表示。 |
java.lang.Double |
getValue()
Returns the value of the current primitive instance.
返回当前原始实例的值。 |
boolean |
isNumber()
Indicates whether JavaScript value is a number value which equals to double type.
指示JavaScript值是否为等于double类型的数字值。 |
toString
asArray, asBoolean, asBooleanObject, asFunction, asJavaObject, asNumberObject, asObject, asString, asStringObject, getBooleanValue, getStringValue, isArray, isBoolean, isBooleanObject, isFunction, isJavaObject, isNull, isNumberObject, isObject, isString, isStringObject, isUndefined
public int getInteger()
public long getLong()
public float getFloat()
public double getDouble()
public byte getByte()
public short getShort()
public boolean isNumber()
JSValue
true
, then the value can be casted to
JSNumber
type. For example:
if (value.isNumber()) { JSNumber number = value.asNumber(); }
public double getNumberValue()
JSValue
IllegalStateException
.
getNumberValue
in class
JSValue
public JSNumber asNumber()
JSValue
JSNumber
type. If the current object doesn't represent a number value, the
IllegalStateException
error is thrown.
public java.lang.Double getValue()
JSPrimitive
getValue
in class
JSPrimitive<java.lang.Double>