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, ComponentBinding, ExpressionBinding, HiveMindBinding, ListenerMethodBinding, LiteralBinding, MessageBinding, StateBinding, TranslatorBinding, ValidatorBinding, ValidatorsBinding

public abstract class AbstractBinding
extends java.lang.Object
implements IBinding

Base class for IBindingimplementations.

Author:
Howard Lewis Ship

Constructor Summary
protected AbstractBinding(java.lang.String description, ValueConverter valueConverter, org.apache.hivemind.Location location)
           
 
Method Summary
protected  BindingException createReadOnlyBindingException(IBinding binding)
           
protected  void extendDescription(java.lang.StringBuffer buffer)
          Does nothing, subclasses may override to add additional information.
 java.lang.Object getComponent()
          Returns the component to which this binding is connected; this is currently only used when building certain exceptions.
 java.lang.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()
           
 java.lang.Object getObject(java.lang.Class type)
          Returns the value for the binding after performing some basic checks.
 ValueConverter getValueConverter()
           
 boolean isInvariant()
          Default implementation: returns true.
 void setObject(java.lang.Object value)
          Overridden in subclasses that are not invariant.
 java.lang.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
 

Constructor Detail

AbstractBinding

protected AbstractBinding(java.lang.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(java.lang.Object value)
Overridden in subclasses that are not invariant.

Specified by:
setObject in interface IBinding
Throws:
ReadOnlyBindingException - always.

isInvariant

public boolean isInvariant()
Default implementation: returns true.

Specified by:
isInvariant in interface IBinding
Since:
2.0.3

getObject

public java.lang.Object getObject(java.lang.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 java.lang.Object getComponent()
Returns the component to which this binding is connected; this is currently only used when building certain exceptions. This implementation returns null.

Since:
4.0

createReadOnlyBindingException

protected BindingException createReadOnlyBindingException(IBinding binding)
Since:
3.0

getDescription

public java.lang.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()
Since:
4.0

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

extendDescription

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