intarsys runtime library

de.intarsys.tools.tree
Class CommonNodeFactory<T extends CommonNode>

java.lang.Object
  extended by de.intarsys.tools.tree.CommonNodeFactory<T>
Type Parameters:
T -

public abstract class CommonNodeFactory<T extends CommonNode>
extends Object

The common implementation of a CommonNode factory.

This implementation ensures uniqueness of an object->node association within the parent node. This means within a given parent context, the node returned for a given object is always the same.

While all factories have their own way of creating a node based on the POJO, they all share the ability to "fine tune" the node creation in a certain context (role).

For fine tuning node creation, just register some other node factories using "registerFactory". Upon creation of a node for this specific role, all registered factories are searched if there is a more specific one for the creation based on the objects's class.


Method Summary
abstract  T createNode(CommonNode parent, Object object)
           
 CommonNodeFactory<?> lookupFactory(Object object)
           
 CommonNode lookupNode(CommonNode parent, Object object)
           
 void registerFactory(Class<?> clazz, CommonNodeFactory<?> factory)
           
 void registerNode(CommonNode parent, CommonNode node)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

createNode

public abstract T createNode(CommonNode parent,
                             Object object)

lookupFactory

public CommonNodeFactory<?> lookupFactory(Object object)

lookupNode

public CommonNode lookupNode(CommonNode parent,
                             Object object)

registerFactory

public void registerFactory(Class<?> clazz,
                            CommonNodeFactory<?> factory)

registerNode

public void registerNode(CommonNode parent,
                         CommonNode node)

intarsys runtime library

Copyright © 2012 intarsys consulting GmbH. All Rights Reserved.