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 ofBinding.get()
.
-
-
Constructor Summary
Constructors Modifier Constructor Description AbstractBinding()
protected
AbstractBinding(Location location)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T extends java.lang.annotation.Annotation>
TgetAnnotation(java.lang.Class<T> annotationClass)
Always returns null.java.lang.reflect.Type
getBindingGenericType()
Passes straight through togetBindingType()
.java.lang.Class
getBindingType()
Returns the actual class, by invokingBinding.get()
.boolean
isInvariant()
Returns true.void
set(java.lang.Object value)
Updates the current value.-
Methods inherited from class org.apache.tapestry5.ioc.BaseLocatable
getLocation
-
-
-
-
Constructor Detail
-
AbstractBinding
public AbstractBinding()
-
AbstractBinding
protected AbstractBinding(Location location)
-
-
Method Detail
-
set
public void set(java.lang.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 interfaceBinding
- 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 interfaceBinding
-
getBindingType
public java.lang.Class getBindingType()
Returns the actual class, by invokingBinding.get()
. Subclasses may override this method to work more efficiently (say, when the binding type is known statically).- Specified by:
getBindingType
in interfaceBinding
-
getBindingGenericType
public java.lang.reflect.Type getBindingGenericType()
Passes straight through togetBindingType()
. Subclasses may override this method to return the generic type if it is available- Specified by:
getBindingGenericType
in interfaceBinding2
- See Also:
Method.getGenericReturnType()
,Field.getGenericType()
-
getAnnotation
public <T extends java.lang.annotation.Annotation> T getAnnotation(java.lang.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 interfaceAnnotationProvider
- Parameters:
annotationClass
- used to select the annotation to return- Returns:
- the annotation, or null if not found
-
-