com.townleyenterprises.common
Class OverrideManager

java.lang.Object
  extended bycom.townleyenterprises.common.OverrideManager
Direct Known Subclasses:
ResourceManager

public abstract class OverrideManager
extends java.lang.Object

This class provides an implementation for tracking overridable nodes based on a pluggable override strategy.

Version:
$Id: OverrideManager.java,v 1.1 2004/07/29 18:29:20 atownley Exp $
Author:
Andrew S. Townley

Constructor Summary
OverrideManager()
           
 
Method Summary
 java.lang.Object get(java.lang.Object key)
          This method retrieves the value for the specified key.
 java.util.Collection getKeys()
          This method returns all of the keys managed by this instance.
protected abstract  java.util.Collection getKeys(java.lang.Object object)
          This method is used to retrieve the property keys from the specified object.
protected  OverrideNode getNode(java.lang.Object key)
          This method is used to retrieve the specific OverrideNode associated with the given key.
protected abstract  java.lang.Object getValue(java.lang.Object key, java.lang.Object object)
          This method is used to retrieve the value for the specific property key given the managed object.
 void manage(java.lang.Object object)
          This method is used to add the specified object to the managed objects of this instance.
protected  java.lang.Object resolve(java.lang.Object key, java.lang.Object s1, java.lang.Object s2)
          Provide an implementation of the strategy interface based on the configured strategy.
 void setOverrideStrategy(OverrideStrategy strategy)
          This method is used to configure the override strategy used when adding new objects.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OverrideManager

public OverrideManager()
Method Detail

getKeys

public java.util.Collection getKeys()
This method returns all of the keys managed by this instance.

Returns:
the keys as a collection

get

public java.lang.Object get(java.lang.Object key)
This method retrieves the value for the specified key.

Parameters:
key - the key to retrieve
Returns:
the value for the key or null if the key doesn't exist

manage

public void manage(java.lang.Object object)
This method is used to add the specified object to the managed objects of this instance. Concrete instances of this class must be able to provide an implementation of the {#getKeys} method which can enumerate the keys of the specified object.

Parameters:
object - the object to manage

setOverrideStrategy

public void setOverrideStrategy(OverrideStrategy strategy)
This method is used to configure the override strategy used when adding new objects.

Parameters:
strategy - the strategy

resolve

protected final java.lang.Object resolve(java.lang.Object key,
                                         java.lang.Object s1,
                                         java.lang.Object s2)
Provide an implementation of the strategy interface based on the configured strategy.

Parameters:
key - the key
s1 - the first supplier
s2 - the second supplier
Returns:
the object providing the property for the given key

getKeys

protected abstract java.util.Collection getKeys(java.lang.Object object)
This method is used to retrieve the property keys from the specified object. The current assumption is that all objects managed by this class will at least conform to a common interface.

Parameters:
object - the object to manage
Returns:
a collection of key values

getValue

protected abstract java.lang.Object getValue(java.lang.Object key,
                                             java.lang.Object object)
This method is used to retrieve the value for the specific property key given the managed object.

Parameters:
key - the key to retrieve
object - the object to manipulate
Returns:
the value for the key

getNode

protected OverrideNode getNode(java.lang.Object key)
This method is used to retrieve the specific OverrideNode associated with the given key.

Parameters:
key - the key
Returns:
the node


Copyright © 2002-2004, Andrew S. Townley and Townley Enterprises. All Rights Reserved.
This project is hosted on http://te-code.sourceforge.net.