Class PropertyAdapterImpl
- java.lang.Object
-
- org.apache.tapestry5.beanmodel.internal.services.PropertyAdapterImpl
-
- All Implemented Interfaces:
AnnotationProvider,PropertyAdapter
public class PropertyAdapterImpl extends java.lang.Object implements PropertyAdapter
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Objectget(java.lang.Object instance)Reads the property value.<T extends java.lang.annotation.Annotation>
TgetAnnotation(java.lang.Class<T> annotationClass)Searches for the specified annotation, returning the matching annotation instance.java.lang.ClassgetBeanType()Returns the type of bean to which this property belongs.ClassPropertyAdaptergetClassAdapter()Returns theClassPropertyAdapterthat provides access to other properties defined by the same class.java.lang.ClassgetDeclaringClass()The class in which the property (or public field) is defined.java.lang.reflect.FieldgetField()Returns the field if the property is a public field or null if the property is accessed via the read method.java.lang.StringgetName()Returns the name of the property (or public field).java.lang.reflect.MethodgetReadMethod()Returns the method used to read the property, or null if the property is not readable (or is a public field).java.lang.ClassgetType()Returns the type of the property.java.lang.reflect.MethodgetWriteMethod()Returns the method used to update the property, or null if the property is not writeable (or a public field).booleanisCastRequired()Returns true if the return type of the read method is not the same as the property type.booleanisField()Returns true if the property is actually a public field (possibly, a public static field).booleanisRead()Returns true if the property is readable (i.e., has a getter method or is a public field).booleanisUpdate()Returns true if the property is writeable (i.e., has a setter method or is a non-final field).voidset(java.lang.Object instance, java.lang.Object value)Updates the property value.
-
-
-
Method Detail
-
getName
public java.lang.String getName()
Description copied from interface:PropertyAdapterReturns the name of the property (or public field).- Specified by:
getNamein interfacePropertyAdapter
-
getReadMethod
public java.lang.reflect.Method getReadMethod()
Description copied from interface:PropertyAdapterReturns the method used to read the property, or null if the property is not readable (or is a public field).- Specified by:
getReadMethodin interfacePropertyAdapter
-
getType
public java.lang.Class getType()
Description copied from interface:PropertyAdapterReturns the type of the property.- Specified by:
getTypein interfacePropertyAdapter
-
getWriteMethod
public java.lang.reflect.Method getWriteMethod()
Description copied from interface:PropertyAdapterReturns the method used to update the property, or null if the property is not writeable (or a public field).- Specified by:
getWriteMethodin interfacePropertyAdapter
-
isRead
public boolean isRead()
Description copied from interface:PropertyAdapterReturns true if the property is readable (i.e., has a getter method or is a public field).- Specified by:
isReadin interfacePropertyAdapter
-
isUpdate
public boolean isUpdate()
Description copied from interface:PropertyAdapterReturns true if the property is writeable (i.e., has a setter method or is a non-final field).- Specified by:
isUpdatein interfacePropertyAdapter
-
get
public java.lang.Object get(java.lang.Object instance)
Description copied from interface:PropertyAdapterReads the property value.- Specified by:
getin interfacePropertyAdapter- Parameters:
instance- to read from
-
set
public void set(java.lang.Object instance, java.lang.Object value)
Description copied from interface:PropertyAdapterUpdates the property value. The provided value must not be null if the property type is primitive, and must otherwise be of the proper type.- Specified by:
setin interfacePropertyAdapter- Parameters:
instance- to updatevalue- new value for the property
-
getAnnotation
public <T extends java.lang.annotation.Annotation> T getAnnotation(java.lang.Class<T> annotationClass)
Description copied from interface:AnnotationProviderSearches for the specified annotation, returning the matching annotation instance.- Specified by:
getAnnotationin interfaceAnnotationProvider- Parameters:
annotationClass- used to select the annotation to return- Returns:
- the annotation, or null if not found
-
isCastRequired
public boolean isCastRequired()
Description copied from interface:PropertyAdapterReturns true if the return type of the read method is not the same as the property type. This can occur when the property has been defined using generics, in which case, the method's type may be Object when the property type is something more specific. This method is primarily used when generating runtime code related to the property.- Specified by:
isCastRequiredin interfacePropertyAdapter
-
getClassAdapter
public ClassPropertyAdapter getClassAdapter()
Description copied from interface:PropertyAdapterReturns theClassPropertyAdapterthat provides access to other properties defined by the same class.- Specified by:
getClassAdapterin interfacePropertyAdapter
-
getBeanType
public java.lang.Class getBeanType()
Description copied from interface:PropertyAdapterReturns the type of bean to which this property belongs. This is the same asClassPropertyAdapter.getBeanType().- Specified by:
getBeanTypein interfacePropertyAdapter
-
isField
public boolean isField()
Description copied from interface:PropertyAdapterReturns true if the property is actually a public field (possibly, a public static field).- Specified by:
isFieldin interfacePropertyAdapter
-
getField
public java.lang.reflect.Field getField()
Description copied from interface:PropertyAdapterReturns the field if the property is a public field or null if the property is accessed via the read method.- Specified by:
getFieldin interfacePropertyAdapter
-
getDeclaringClass
public java.lang.Class getDeclaringClass()
Description copied from interface:PropertyAdapterThe class in which the property (or public field) is defined.- Specified by:
getDeclaringClassin interfacePropertyAdapter
-
-