com.mtgi.analytics
Class EventDataElement

java.lang.Object
  extended by com.mtgi.analytics.EventDataElement
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
ImmutableEventDataElement

public class EventDataElement
extends Object
implements Serializable

Semi-structured (XML-like) data about a BehaviorEvent.

See Also:
BehaviorEvent.getData(), Serialized Form

Field Summary
protected  T next
           
 
Constructor Summary
EventDataElement(String name)
           
 
Method Summary
 void add(String name, Object value)
          Set a named attribute on this element.
 void addElement(EventDataElement child)
           
 EventDataElement addElement(String name)
          Add a child element with the given name to this element.
 String getName()
          Get the name of this element
 String getText()
          Get the text of this element, if any
protected  EventDataElement initialize(BehaviorEvent event)
          Return a concrete, fully-realized instance of this data, performing any deferred initialization of internal data structures.
 boolean isEmpty()
           
 boolean isNull()
           
protected  Iterator<EventDataElement> iterate()
          iterate the list of sibling event data elements starting at this element
 Iterator<EventDataElement> iterateChildren()
          iterate all child elements of this event data element previously added with addElement(EventDataElement) or addElement(String)
 Iterator<? extends Map.Entry<String,Object>> iterateProperties()
          iterate all properties previously added with add(String, Object)
protected  void setNext(EventDataElement parent, EventDataElement next)
          set the next sibling in the linked list of children under parent.
 void setText(String text)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

next

protected T extends com.mtgi.analytics.DataLink<T> next
Constructor Detail

EventDataElement

public EventDataElement(String name)
Method Detail

getName

public String getName()
Get the name of this element


getText

public String getText()
Get the text of this element, if any


setText

public void setText(String text)

add

public void add(String name,
                Object value)
Set a named attribute on this element. Values may be null. Calling this method multiple times with the same name will result in previous values being overwritten.


addElement

public EventDataElement addElement(String name)
Add a child element with the given name to this element.


addElement

public void addElement(EventDataElement child)

isEmpty

public boolean isEmpty()
Returns:
true if this element has no child properties or child elements

isNull

public boolean isNull()
Returns:
true if this element is effectively null (should not be rendered in serialized output)

iterateProperties

public Iterator<? extends Map.Entry<String,Object>> iterateProperties()
iterate all properties previously added with add(String, Object)


iterateChildren

public Iterator<EventDataElement> iterateChildren()
iterate all child elements of this event data element previously added with addElement(EventDataElement) or addElement(String)


setNext

protected void setNext(EventDataElement parent,
                       EventDataElement next)
set the next sibling in the linked list of children under parent.


iterate

protected Iterator<EventDataElement> iterate()
iterate the list of sibling event data elements starting at this element


initialize

protected EventDataElement initialize(BehaviorEvent event)
Return a concrete, fully-realized instance of this data, performing any deferred initialization of internal data structures. This will likely be called many times for complex events, so it should return quickly. This implementation simply returns "this".

Parameters:
event - the parent event