org.apache.tapestry.binding
Class AbstractBinding

java.lang.Object
  extended by org.apache.tapestry.binding.AbstractBinding
All Implemented Interfaces:
org.apache.hivemind.Locatable, IBinding
Direct Known Subclasses:
AssetBinding, BeanBinding, ClientIdBinding, ClientIdListBinding, ComponentBinding, ExpressionBinding, HiveMindBinding, ListenerMethodBinding, LiteralBinding, MessageBinding, MetaBinding, StateBinding, TranslatorBinding, UserAttributeBinding, ValidatorBinding, ValidatorsBinding

public abstract class AbstractBinding
extends Object
implements IBinding

Base class for IBindingimplementations.

Author:
Howard Lewis Ship

Field Summary
protected  String _description
           
 
Constructor Summary
protected AbstractBinding(String description, ValueConverter valueConverter, org.apache.hivemind.Location location)
           
 
Method Summary
protected  BindingException createReadOnlyBindingException(IBinding binding)
           
protected  void extendDescription(StringBuffer buffer)
          Does nothing, subclasses may override to add additional information.
 Object getComponent()
          Returns the component to which this binding is connected; this is currently only used when building certain exceptions.
 String getDescription()
          Returns a description of how the binding is used; this description is localized and incorporated into some exception messages.
 org.apache.hivemind.Location getLocation()
           
 Object getObject(Class type)
          Returns the value for the binding after performing some basic checks.
 ValueConverter getValueConverter()
          Gets the converter used to coerce binding values in to their target types.
 boolean isInvariant()
          Default implementation: returns true.
 void setObject(Object value)
          Overridden in subclasses that are not invariant.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.apache.tapestry.IBinding
getObject
 

Field Detail

_description

protected final String _description
Since:
4.0
Constructor Detail

AbstractBinding

protected AbstractBinding(String description,
                          ValueConverter valueConverter,
                          org.apache.hivemind.Location location)
Since:
3.0
Method Detail

getLocation

public org.apache.hivemind.Location getLocation()
Specified by:
getLocation in interface org.apache.hivemind.Locatable

setObject

public void setObject(Object value)
Overridden in subclasses that are not invariant.

Specified by:
setObject in interface IBinding

isInvariant

public boolean isInvariant()
Default implementation: returns true.

Specified by:
isInvariant in interface IBinding
Since:
2.0.3

getObject

public Object getObject(Class type)
Description copied from interface: IBinding
Returns the value for the binding after performing some basic checks.

Note: In release 4.0, the parameterName parameter was removed.

Specified by:
getObject in interface IBinding
Parameters:
type - if not null, the value must be assignable to the specific class

getComponent

public Object getComponent()
Returns the component to which this binding is connected; this is currently only used when building certain exceptions. This implementation returns null.

Returns:
The IComponent object this binding is set against.
Since:
4.0

createReadOnlyBindingException

protected BindingException createReadOnlyBindingException(IBinding binding)
Since:
3.0

getDescription

public String getDescription()
Description copied from interface: IBinding
Returns a description of how the binding is used; this description is localized and incorporated into some exception messages.

Specified by:
getDescription in interface IBinding
Since:
4.0

getValueConverter

public ValueConverter getValueConverter()
Gets the converter used to coerce binding values in to their target types.

Returns:
The ValueConverter being used by this binding.

toString

public String toString()
Overrides:
toString in class Object

extendDescription

protected void extendDescription(StringBuffer buffer)
Does nothing, subclasses may override to add additional information.



Copyright © 2006-2008 Apache Software Foundation. All Rights Reserved.