com.marsching.flexiparse.objecttree
Interface ObjectTreeElement

All Known Subinterfaces:
MutableObjectTreeElement
All Known Implementing Classes:
DefaultMutableObjectTreeElement

public interface ObjectTreeElement

Represents a node in an object tree. Each node can have child nodes and attached objects. Usually a node is created for every element in the origin XML document.

Author:
Sebastian Marsching

Method Summary
 void addObject(Object object)
          Attaches the given object to this node.
 Collection<? extends ObjectTreeElement> getChildren()
          Returns all children of this node.
 Collection<Object> getObjects()
          Returns objects attached directly to this node.
<T> Collection<T>
getObjectsOfType(Class<? extends T> type)
          Returns objects of specified type attached directly to this node.
<T> Collection<T>
getObjectsOfTypeFromSubTree(Class<? extends T> type)
          Returns objects attached to this node and all child nodes (recursively).
<T> Collection<T>
getObjectsOfTypeFromTopTree(Class<? extends T> type)
          Returns objects attached to this node and all parent nodes up to the root node of the tree.
 ObjectTreeElement getParent()
          Returns the parent of this node.
 ObjectTreeElement getRoot()
          Returns the root node of the tree this node belongs to.
 boolean removeObject(Object object)
          Removes a object from this node.
 

Method Detail

getParent

ObjectTreeElement getParent()
Returns the parent of this node.

Returns:
parent of this node or null if this is the root node

getRoot

ObjectTreeElement getRoot()
Returns the root node of the tree this node belongs to.

Returns:
root node of the tree

getChildren

Collection<? extends ObjectTreeElement> getChildren()
Returns all children of this node.

Returns:
a list containing all child nodes of this node

getObjects

Collection<Object> getObjects()
Returns objects attached directly to this node.

Returns:
Objects attached to this node

getObjectsOfType

<T> Collection<T> getObjectsOfType(Class<? extends T> type)
Returns objects of specified type attached directly to this node.

Type Parameters:
T - type of wanted objects
Parameters:
type - object type that is returned
Returns:
objects of specified type attached to this node

getObjectsOfTypeFromTopTree

<T> Collection<T> getObjectsOfTypeFromTopTree(Class<? extends T> type)
Returns objects attached to this node and all parent nodes up to the root node of the tree.

Type Parameters:
T - type of wanted objects
Parameters:
type - object type that is returned
Returns:
objects of specified type attached to this node or one of its parents nodes

getObjectsOfTypeFromSubTree

<T> Collection<T> getObjectsOfTypeFromSubTree(Class<? extends T> type)
Returns objects attached to this node and all child nodes (recursively). Includes objects attached to sub trees (see SubObjectTree).

Type Parameters:
T - type of wanted objects
Parameters:
type - object type that is returned
Returns:
objects of specified type attached to this node or one of its child nodes

addObject

void addObject(Object object)
Attaches the given object to this node.

Parameters:
object - object to attach

removeObject

boolean removeObject(Object object)
Removes a object from this node.

Parameters:
object - object to remove
Returns:
true if the specified object was removed from this node, false otherwise


Copyright © 2008-2009. All Rights Reserved.