Package org.apache.tapestry5.internal.bindings

# Class AbstractBinding

java.lang.Object
org.apache.tapestry5.ioc.BaseLocatable
org.apache.tapestry5.internal.bindings.AbstractBinding

All Implemented Interfaces:
  `Binding`, `Binding2`, `AnnotationProvider`, `Locatable`

Direct Known Subclasses:
  `AssetBinding`, `AttributeExpansionBinding`, `BlockBinding`, `ComponentBinding`, `InvariantBinding`, `LiteralBinding`, `PropBinding`, `RenderVariableBinding`

public abstract class AbstractBinding extends BaseLocatable implements Binding2
Abstract base class for bindings. Assumes that the binding is read only and invariant. Subclasses must provide an implementation of `Binding.get()`.

- ## Constructor Summary

  Constructors
  Modifier
  Constructor
  Description
  ``
  `AbstractBinding()`
  `protected`
  `AbstractBinding(Location location)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `<T extends Annotation>
  T`
  `getAnnotation(Class<T> annotationClass)`
  Always returns null.
  `Type`
  `getBindingGenericType()`
  Passes straight through to `getBindingType()`.
  `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 Details

  - ### AbstractBinding

    public AbstractBinding()

  - ### AbstractBinding

    protected AbstractBinding(Location location)

- ## Method Details

  - ### 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`

  - ### getBindingGenericType

    public Type getBindingGenericType()
    Passes straight through to `getBindingType()`. Subclasses may override this method to return the generic type if it is available
    Specified by:
      `getBindingGenericType` in interface `Binding2`
    See Also:
      - `Method.getGenericReturnType()`
      - `Field.getGenericType()`

  - ### 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