|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
Object
Value
public class Value
Value is a general composite type. It is used when storing data into storage or communicating with the server side.
It can contain following types:
IS_NULL: null, created with NULL()
IS_BOOLEAN: boolean
IS_INT: int
IS_INT: long
IS_STRING: String
IS_BINARY: ByteArray
IS_BINDING: Value-to-Value binding
IS_LIST: list of Values
There are a number of cast operators that convert
between Value and other types.
Value <-> boolean Value <-> int Value <-> long Value <-> String Value <- List Value <-> ByteArray
Value list is the native array format (operator_array()):
Value list = [];
list.add("foo");
list.add("bar");
Value supports inline appending when
being constructed (operator_append(Value)):
Value list = ["foo", "bar"]; Value list2 = ["foo", ["bar", "baz"]];
IS_BINDING can be created with arrow expression
(operator_bind(Value, Value)):
Value tel = "tel"=>"555-HELIUM";
Value person = ["age"=>25,
"name=>"john"];
person.add(tel);
operator_array(),
operator_bind(Value, Value),
operator_append(Value),
call(Object, String, String, Value),
Script.onSuccess(Object, Value),
Script.onFailure(Object, String),
SuccessCallback,
FailureCallback,
Store| Method Summary | |
|---|---|
Value |
add(Value value)
Adds a new element to this Value. |
boolean |
contains(String key)
Checks if any of the child elements with type IS_BINDING has a matching key. |
boolean |
contains(Value key)
Checks if any of the child elements matches given Value. |
Value |
copy()
Returns duplicate of this Value. |
boolean |
isNull()
Checks if this Value is IS_NULL. |
void |
operator_append(Value element)
Array append support, see class description. |
Value |
operator_get(int index)
Returns an element at specified index. |
Value |
operator_get(String key)
Returns right side of IS_BINDING
that has a key that matches given argument. |
Value |
operator_get(Value key)
Returns right side of IS_BINDING
that has a key matching given argument. |
Value |
operator_set(int index,
Value value)
Sets element at specified index. |
Value |
operator_set(String key,
Value value)
Sets right side of IS_BINDING
that has a key matching given argument. |
Value |
operator_set(Value key,
Value value)
Sets right side of IS_BINDING
that has a key matching given argument. |
Value |
remove(int index)
Removes an element at specified index from this Value. |
Value |
remove(Value value)
Removes an element from this Value. |
int |
size()
Returns the size of elements in this Value. |
int |
type()
Returns the type of Value. |
| Methods inherited from class Object |
|---|
toString, equals, hashCode |
| Methods inherited from |
|---|
equals, getClass, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public int type()
IS_NULL,
IS_BOOLEAN,
IS_INT,
IS_STRING,
IS_LIST,
IS_BINDING,
IS_BINARYpublic int size()
IS_LIST: number of elements
IS_STRING: length of String
IS_BINARY: size of ByteArray
IS_BINDING: always two
public Value copy()
public Value add(Value value)
IS_LIST.
value - Element to add
public Value remove(Value value)
IS_LIST.
value - Element to remove
public Value remove(int index)
IS_LIST.
index - Index of element, must be on range [0..size()-1]
public Value operator_get(int index)
IS_LIST or
IS_BINDING.
index - Index of element, must be on range [0..size()-1]
public Value operator_get(Value key)
IS_BINDING
that has a key matching given argument.
Only meaningful when type is IS_LIST.
key - Key to look for
IS_NULL if it wasn't found.public Value operator_get(String key)
IS_BINDING
that has a key that matches given argument.
Only meaningful when type is IS_LIST.
key - Key to look for
IS_NULL if it wasn't found.
public Value operator_set(int index,
Value value)
IS_LIST.
index - Index of element, must be on range [0..size()-1]value - Element to set
public Value operator_set(Value key,
Value value)
IS_BINDING
that has a key matching given argument.
If there wasn't any such binding, adds
a new binding.
Only meaningful when type is IS_LIST.
key - Key to look forvalue - Element to set
public Value operator_set(String key,
Value value)
IS_BINDING
that has a key matching given argument.
If there wasn't any such binding, adds
a new binding.
Only meaningful when type is IS_LIST.
key - Key to look forvalue - Element to setpublic boolean contains(String key)
IS_BINDING has a matching key.
Only meaningful when type is IS_LIST.
true if matching binding was found,
false otherwisepublic boolean contains(Value key)
IS_LIST.
key - Key to search for
true if element was found,
false otherwisepublic void operator_append(Value element)
public boolean isNull()
IS_NULL.
true if IS_NULL,
false otherwise.
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||