org.apache.tapestry5.internal.bindings
Class AbstractBinding

java.lang.Object
  extended by org.apache.tapestry5.ioc.BaseLocatable
      extended by org.apache.tapestry5.internal.bindings.AbstractBinding
All Implemented Interfaces:
Binding, AnnotationProvider, Locatable
Direct Known Subclasses:
AssetBinding, AttributeExpansionBinding, BlockBinding, ComponentBinding, InvariantBinding, LiteralBinding, PropBinding, RenderVariableBinding

public abstract class AbstractBinding
extends BaseLocatable
implements Binding

Abstract base class for bindings. Assumes that the binding is read only and invariant. Subclasses must provide an implementation of Binding.get().


Constructor Summary
  AbstractBinding()
           
protected AbstractBinding(Location location)
           
 
Method Summary
<T extends Annotation>
T
getAnnotation(Class<T> annotationClass)
          Always returns null.
 Class getBindingType()
          Returns the actual class, by invoking Binding.get().
 boolean isInvariant()
          Returns true.
 void set(Object value)
          Updates the current value.
 
Methods inherited from class org.apache.tapestry5.ioc.BaseLocatable
getLocation
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.tapestry5.Binding
get
 

Constructor Detail

AbstractBinding

public AbstractBinding()

AbstractBinding

protected AbstractBinding(Location location)
Method Detail

set

public void set(Object value)
Description copied from interface: Binding
Updates the current value. Most types of bindings are read-only, and this method will throw a runtime exception. It is the caller's responsibility to ensure that the value passed in is of the appropriate type.

Specified by:
set in interface Binding
Throws:
TapestryException - always

isInvariant

public boolean isInvariant()
Returns true. Subclasses that do not supply a fixed, read-only value should override this method to return false.

Specified by:
isInvariant in interface Binding

getBindingType

public Class getBindingType()
Returns the actual class, by invoking Binding.get(). Subclasses may override this method to work more efficiently (say, when the binding type is known statically).

Specified by:
getBindingType in interface Binding

getAnnotation

public <T extends Annotation> T getAnnotation(Class<T> annotationClass)
Always returns null. Bindings that provide access to a method or field will override this method to return the appropriate annotation.

Specified by:
getAnnotation in interface AnnotationProvider
Parameters:
annotationClass - used to select the annotation to return
Returns:
the annotation, or null if not found


Copyright © 2003-2012 The Apache Software Foundation.