|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object
|
+--one.world.core.Tuple
|
+--one.world.core.Event
|
+--one.world.core.DynamicTuple
Implementation of a dynamically typed tuple. A dynamically typed tuple implements a mapping from field names to values. Fields can be dynamically added and removed as well as modified.
Note that access to the dynamic fields of a dynamic tuple is not synchronized. Concurrenct accesses must be synchronized externally.
Tuple, Serialized Form| Fields inherited from class one.world.core.Event |
closure, source |
| Fields inherited from class one.world.core.Tuple |
CLOSURE, id, ID, META_DATA, metaData, SOURCE |
| Constructor Summary | |
DynamicTuple()
Create a new, empty dynamically typed tuple. |
|
DynamicTuple(EventHandler source,
Object closure)
Create a new dynamically typed tuple with the specified source and closure. |
|
| Method Summary | |
Object |
clone()
Make a shallow copy of this dynamic tuple. |
List |
fields()
Get a list of this tuple's field names. |
Object |
get(String name)
Get the value of the specified field. |
Object |
get(String name,
Class k,
boolean allowNull)
Get the value of the specified field. |
Class |
getType(String name)
Get the declared type of the field with the specified name. |
boolean |
hasField(String name)
Determine whether this tuple has a field with the specified name. |
void |
set(String name,
Object value)
Set the specified field to the specified value. |
String |
toString()
Get a string representation for this dynamic tuple. |
void |
validate()
Validate this dynamic tuple. |
| Methods inherited from class one.world.core.Tuple |
containsNonSymbolicHandler, equals, getMetaData, hashCode, hasMetaData, remove, setMetaData, wrap |
| Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public DynamicTuple()
NullHandler
public DynamicTuple(EventHandler source,
Object closure)
source - The source for the new dynamically typed tuple.closure - The closure for the new dynamically typed tuple.| Method Detail |
public Object clone()
clone in class Tupleone.world.core.Tuplepublic Object get(String name)
get in class Tupleone.world.core.Tuplename - The name of the field.null if this tuple has no such field.
public final Object get(String name,
Class k,
boolean allowNull)
Note that this method cannot be used to access the four
statically typed fields id,
metaData, source, and
closure of a dynamic tuple.
name - The name of the field.k - The required type for the field's value.allowNull - Flag for whether to allow null
values.IllegalArgumentException - Signals that this dynamic tuple does not have
a field with the specified name, that the
field's value does not have the specified
type, or that the field's value is
null and allowNull
is false.
public void set(String name,
Object value)
set in class Tupleone.world.core.Tuplename - The name of the field.value - The new value for the field.IllegalArgumentException - Signals that a statically typed tuples does not
have a field with the specified name or that the
specified value is of the wrong type.public boolean hasField(String name)
hasField in class Tupleone.world.core.Tuplename - The name of the field to test for.true if this tuple has a field with
the specified name.public Class getType(String name)
getType in class Tupleone.world.core.Tuplename - The name of the field.public List fields()
fields in class Tupleone.world.core.Tuple
public void validate()
throws TupleException
validate in class Eventone.world.core.TupleTupleException - Signals that the tuple is either malformed
(i.e., does not conform to the tuple
specification) or invalid (i.e., does not
conform to the semantic constraints of its
type).MalformedTupleException,
InvalidTupleException,
Type.validate(Class)public String toString()
toString in class Tupleone.world.core.Tuple
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||