org.apache.tapestry.bean
Class Default

java.lang.Object
  extended by org.apache.tapestry.bean.Default
All Implemented Interfaces:
IPoolable

public class Default
extends Object
implements IPoolable

A helper bean to assist with providing defaults for unspecified parameters. It is initalized with an IBinding and a default value. It's value property is either the value of the binding, but if the binding is null, or the binding returns null, the default value is returned.

Since:
1.0.5
Version:
$Id: Default.java 243791 2004-02-19 17:38:13Z hlship $
Author:
Howard Lewis Ship

Constructor Summary
Default()
           
 
Method Summary
 void discardFromPool()
          Invoked just as a Pool discards an object (for lack of use).
 IBinding getBinding()
           
 Object getDefaultValue()
           
 Object getValue()
          Returns the value of the binding.
 void resetForPool()
          Invoked by a Pool just before the object is added to the pool.
 void setBinding(IBinding value)
           
 void setDefaultValue(Object value)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Default

public Default()
Method Detail

resetForPool

public void resetForPool()
Description copied from interface: IPoolable
Invoked by a Pool just before the object is added to the pool. The object should return its state to how it was when freshly instantiated (or at least, its state should be indistinguishable from a freshly instantiated instance).

Specified by:
resetForPool in interface IPoolable

setBinding

public void setBinding(IBinding value)

getBinding

public IBinding getBinding()

setDefaultValue

public void setDefaultValue(Object value)

getDefaultValue

public Object getDefaultValue()

getValue

public Object getValue()
Returns the value of the binding. However, if the binding is null, or the binding returns null, then the defaultValue is returned instead.


discardFromPool

public void discardFromPool()
Description copied from interface: IPoolable
Invoked just as a Pool discards an object (for lack of use). This allows a last chance to perform final cleanup on the object while it is still referencable.

Specified by:
discardFromPool in interface IPoolable
Since:
3.0