Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Multivalent API
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## multivalent
Class VObject

    java.lang.Object
      multivalent.VObject

Direct Known Subclasses:
  Behavior, Node

public abstract class VObject
extends java.lang.Object

`Object`s with a name and attributes. Superclass of `Behavior` and `Node`. Attributes are generally `String`s, but `VObject`s that are not to be written to a hub can store any `Object` as the `value`. Most getters optionally take a second value, a default that's returned if the attribute does not exist or cannot be interpreted as the requested type, rather than throwing an exception in that case.

Also validate, statistics.

Version:
  $Revision: 1.6 $ $Date: 2003/06/02 05:11:39 $

Field Summary
`protected java.util.Map<java.lang.String,java.lang.Object>` | `attr_` All Behaviors and Nodes have attributes, that is, a set (possibly empty) of key, value pairs.

Constructor Summary
`VObject()`

Method Summary
`java.util.Iterator<java.util.Map.Entry<java.lang.String,java.lang.Object>>` | `attrEntrySetIterator()`
`java.util.Iterator<java.lang.String>` | `attrKeysIterator()`
`boolean` | `checkRep()` Checks "representation invariant" (see MIT SE), and returns true iff object is valid, which should be always
`void` | `clearAttributes()`
`java.lang.String` | `getAttr(java.lang.String key)`
`java.lang.String` | `getAttr(java.lang.String key, java.lang.String default_)` Same as `getAttr(String)`, except if no such key, then return default_.
`java.util.Map<java.lang.String,java.lang.Object>` | `getAttributes()` Needed for scripting, testing and moving from ESISNode to real node, but not for general use.
`Multivalent` | `getGlobal()` Convenience method to global state in class Multivalent.
`abstract java.lang.String` | `getName()`
`java.lang.Object` | `getValue(java.lang.String key)` Return attribute value that might not be of type String.
`boolean` | `hasAttributes()` DOM2.
`void` | `putAttr(java.lang.String key, java.lang.Object val)` If val == `null`, remove attribute.
`java.lang.Object` | `removeAttr(java.lang.String key)` Returns old value of key.
`void` | `setAttributes(java.util.Map<java.lang.String,java.lang.Object> attrs)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### attr_

    protected java.util.Map<java.lang.String,java.lang.Object> attr_

  All Behaviors and Nodes have attributes, that is, a set (possibly empty) of key, value pairs. Attributes keys must be Strings, and are canonicalized to all lowercase. Values must be Strings. By default, attributes are kept in a CHashMap, which ignores that case of the key; if a `HashMap` is desired, create the object with one.

Constructor Detail

### VObject

    public VObject()

Method Detail

### getName

    public abstract java.lang.String getName()

### getGlobal

    public Multivalent getGlobal()

  Convenience method to global state in class Multivalent.

### getAttributes

    public final java.util.Map<java.lang.String,java.lang.Object> getAttributes()

  Needed for scripting, testing and moving from ESISNode to real node, but not for general use.

### setAttributes

    public final void setAttributes(java.util.Map<java.lang.String,java.lang.Object> attrs)

### hasAttributes

    public boolean hasAttributes()

  DOM2.

### getValue

    public final java.lang.Object getValue(java.lang.String key)

  Return attribute value that might not be of type String.

### getAttr

    public final java.lang.String getAttr(java.lang.String key)

### getAttr

    public final java.lang.String getAttr(java.lang.String key,
                                          java.lang.String default_)

  Same as `getAttr(String)`, except if no such key, then return default_.

### putAttr

    public final void putAttr(java.lang.String key,
                              java.lang.Object val)

  If val == `null`, remove attribute.

### removeAttr

    public final java.lang.Object removeAttr(java.lang.String key)

  Returns old value of key.

### clearAttributes

    public final void clearAttributes()

### attrKeysIterator

    public final java.util.Iterator<java.lang.String> attrKeysIterator()

### attrEntrySetIterator

    public final java.util.Iterator<java.util.Map.Entry<java.lang.String,java.lang.Object>> attrEntrySetIterator()

### checkRep

    public boolean checkRep()

  Checks "representation invariant" (see MIT SE), and returns true iff object is valid, which should be always.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Multivalent API
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD