org.apache.tapestry5.services
Interface TransformField

All Superinterfaces:
AnnotationProvider, Comparable<TransformField>

public interface TransformField
extends AnnotationProvider, Comparable<TransformField>

A field defined by (or created within) a ClassTransformation, allowing the details of the field to be accessed or modified.

Since:
5.2.0

Method Summary
 void claim(Object tag)
          Claims the field so as to ensure that only a single annotation is applied to any single field.
 FieldAccess getAccess()
          Returns an object that can be used to access the value of the field for read and update.
 int getModifiers()
          Returns the modifiers for the field.
 String getName()
          Returns the name of the field.
 String getSignature()
          Returns the field's fully qualified generic type, or null if not defined.
 String getType()
          Returns the field's type, either a primitive name (such as "int" or "boolean") or a fully qualified class name, or an array type name (in Java source syntax, i.e., "java.lang.String[]").
 void inject(Object value)
          Converts this field into a read only field whose value is the provided value.
<T> void
injectIndirect(ComponentValueProvider<T> provider)
          Like inject(Object), except that the value to be injected is obtained from a ComponentValueProvider.
 void replaceAccess(ComponentValueProvider<FieldValueConduit> conduitProvider)
          Replaces read and write field access with a conduit.
 void replaceAccess(FieldValueConduit conduit)
          Replaces read and write field access with a conduit.
 void replaceAccess(TransformField conduitField)
          Replaces read and write field access with a conduit.
 
Methods inherited from interface org.apache.tapestry5.ioc.AnnotationProvider
getAnnotation
 
Methods inherited from interface java.lang.Comparable
compareTo
 

Method Detail

getName

String getName()
Returns the name of the field.


getType

String getType()
Returns the field's type, either a primitive name (such as "int" or "boolean") or a fully qualified class name, or an array type name (in Java source syntax, i.e., "java.lang.String[]").


getSignature

String getSignature()
Returns the field's fully qualified generic type, or null if not defined. (in Java source syntax, i.e., "()Ljava/util/List;"

Since:
5.3

claim

void claim(Object tag)
Claims the field so as to ensure that only a single annotation is applied to any single field. When a transformation occurs (driven by a field annotation), the field is claimed (using the annotation object as the tag). If a field has multiple conflicting annotations, this will be discovered when the code attempts to claim the field a second time.

Parameters:
tag - a non-null object that represents why the field is being tagged (this is typically a specific annotation on the field)
Throws:
IllegalStateException - if the field is already claimed for some other tag

replaceAccess

void replaceAccess(ComponentValueProvider<FieldValueConduit> conduitProvider)
Replaces read and write field access with a conduit.

Parameters:
conduitProvider - provides the actual conduit at class instantiation time

replaceAccess

void replaceAccess(TransformField conduitField)
Replaces read and write field access with a conduit.

Parameters:
conduitField - identifies the field containing (via injection) an instance of FieldValueConduit

replaceAccess

void replaceAccess(FieldValueConduit conduit)
Replaces read and write field access with a conduit. A new field is created for the conduit instance.

Parameters:
conduit - used to replace read and write access to the field

getModifiers

int getModifiers()
Returns the modifiers for the field.

See Also:
Field.getModifiers()

inject

void inject(Object value)
Converts this field into a read only field whose value is the provided value. This is used when converting an existing field into a read-only injected value.

Parameters:
value - the value provided by the field

injectIndirect

<T> void injectIndirect(ComponentValueProvider<T> provider)
Like inject(Object), except that the value to be injected is obtained from a ComponentValueProvider. It is assumed that the provider will return an object assignable to the field.

Type Parameters:
T - type of field
Parameters:
provider - provides the value to be assigned to the field

getAccess

FieldAccess getAccess()
Returns an object that can be used to access the value of the field for read and update. Changes to the field will honor any FieldValueConduit that has been applied to the field.



Copyright © 2003-2012 The Apache Software Foundation.