public class Value
extends com.google.gwt.core.client.JavaScriptObject
Value
is an object wrapping a primitive or a complex value.
A Value
is returned from many gwt-d3 functions.
The wrapped value can be retrieved from the numerous as*() methods.
Modifier | Constructor and Description |
---|---|
protected |
Value() |
Modifier and Type | Method and Description |
---|---|
<T> T |
as()
Cast and return the wrapped value, if possible.
|
<T> T |
as(Class<T> clazz)
Cast and return the wrapped value.
|
boolean |
asBoolean()
Cast and return the wrapped value.
|
byte |
asByte()
Cast and return the wrapped value.
|
char |
asChar()
Cast and return the wrapped value.
|
Coords |
asCoords()
Return the value casted to a
Coords object. |
double |
asDouble()
Cast and return the wrapped value.
|
float |
asFloat()
Cast and return the wrapped value.
|
int |
asInt()
Cast and return the wrapped value.
|
com.google.gwt.core.client.JsDate |
asJsDate() |
long |
asLong()
Cast and return the value.
|
short |
asShort()
Cast and return the wrapped value.
|
String |
asString()
Return the value casted to a String.
|
static Value |
create(com.google.gwt.core.client.JavaScriptObject object,
String propertyName)
Create a
Value instance from the value of the named property of
the given object. |
static Value |
create(Object o)
Wraps the given object into a
Value . |
Value |
getProperty(String propertyName)
Return the property of this object as a
Value . |
boolean |
isBoolean() |
boolean |
isDefined() |
boolean |
isFunction() |
boolean |
isNull() |
boolean |
isString() |
boolean |
isUndefined() |
String |
typeof()
The result of the typeof operator.
|
public static final Value create(Object o)
Value
.o
- the object to be wrapped as a Valuepublic static final Value create(com.google.gwt.core.client.JavaScriptObject object, String propertyName)
Value
instance from the value of the named property of
the given object.object
- propertyName
- public final boolean asBoolean()
public final byte asByte()
public final char asChar()
public final com.google.gwt.core.client.JsDate asJsDate()
public final double asDouble()
public final float asFloat()
public final int asInt()
public final long asLong()
public final short asShort()
public final String asString()
public final Coords asCoords()
Coords
object.
public final <T> T as()
ClassCastException
- if the value cannot be converted in Tpublic final <T> T as(Class<T> clazz)
clazz
- the clazz to cast topublic final boolean isDefined()
public final boolean isUndefined()
public final boolean isNull()
public final boolean isString()
public final boolean isFunction()
public final boolean isBoolean()
public final Value getProperty(String propertyName)
Value
.
This method result is never non-null. The returned value may then be tested for nullity (with isNull()
)
or for undefinition (with isUndefined()
).
propertyName
- the name of the property to getpublic final String typeof()
Copyright © 2015 gwt-d3. All rights reserved.