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.Object
get(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.Class
getBeanType()
Returns the type of bean to which this property belongs.ClassPropertyAdapter
getClassAdapter()
Returns theClassPropertyAdapter
that provides access to other properties defined by the same class.java.lang.Class
getDeclaringClass()
The class in which the property (or public field) is defined.java.lang.reflect.Field
getField()
Returns the field if the property is a public field or null if the property is accessed via the read method.java.lang.String
getName()
Returns the name of the property (or public field).java.lang.reflect.Method
getReadMethod()
Returns the method used to read the property, or null if the property is not readable (or is a public field).java.lang.Class
getType()
Returns the type of the property.java.lang.reflect.Method
getWriteMethod()
Returns the method used to update the property, or null if the property is not writeable (or a public field).boolean
isCastRequired()
Returns true if the return type of the read method is not the same as the property type.boolean
isField()
Returns true if the property is actually a public field (possibly, a public static field).boolean
isRead()
Returns true if the property is readable (i.e., has a getter method or is a public field).boolean
isUpdate()
Returns true if the property is writeable (i.e., has a setter method or is a non-final field).void
set(java.lang.Object instance, java.lang.Object value)
Updates the property value.
-
-
-
Method Detail
-
getName
public java.lang.String getName()
Description copied from interface:PropertyAdapter
Returns the name of the property (or public field).- Specified by:
getName
in interfacePropertyAdapter
-
getReadMethod
public java.lang.reflect.Method getReadMethod()
Description copied from interface:PropertyAdapter
Returns the method used to read the property, or null if the property is not readable (or is a public field).- Specified by:
getReadMethod
in interfacePropertyAdapter
-
getType
public java.lang.Class getType()
Description copied from interface:PropertyAdapter
Returns the type of the property.- Specified by:
getType
in interfacePropertyAdapter
-
getWriteMethod
public java.lang.reflect.Method getWriteMethod()
Description copied from interface:PropertyAdapter
Returns the method used to update the property, or null if the property is not writeable (or a public field).- Specified by:
getWriteMethod
in interfacePropertyAdapter
-
isRead
public boolean isRead()
Description copied from interface:PropertyAdapter
Returns true if the property is readable (i.e., has a getter method or is a public field).- Specified by:
isRead
in interfacePropertyAdapter
-
isUpdate
public boolean isUpdate()
Description copied from interface:PropertyAdapter
Returns true if the property is writeable (i.e., has a setter method or is a non-final field).- Specified by:
isUpdate
in interfacePropertyAdapter
-
get
public java.lang.Object get(java.lang.Object instance)
Description copied from interface:PropertyAdapter
Reads the property value.- Specified by:
get
in interfacePropertyAdapter
- Parameters:
instance
- to read from
-
set
public void set(java.lang.Object instance, java.lang.Object value)
Description copied from interface:PropertyAdapter
Updates 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:
set
in 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:AnnotationProvider
Searches for the specified annotation, returning the matching annotation instance.- Specified by:
getAnnotation
in 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:PropertyAdapter
Returns 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:
isCastRequired
in interfacePropertyAdapter
-
getClassAdapter
public ClassPropertyAdapter getClassAdapter()
Description copied from interface:PropertyAdapter
Returns theClassPropertyAdapter
that provides access to other properties defined by the same class.- Specified by:
getClassAdapter
in interfacePropertyAdapter
-
getBeanType
public java.lang.Class getBeanType()
Description copied from interface:PropertyAdapter
Returns the type of bean to which this property belongs. This is the same asClassPropertyAdapter.getBeanType()
.- Specified by:
getBeanType
in interfacePropertyAdapter
-
isField
public boolean isField()
Description copied from interface:PropertyAdapter
Returns true if the property is actually a public field (possibly, a public static field).- Specified by:
isField
in interfacePropertyAdapter
-
getField
public java.lang.reflect.Field getField()
Description copied from interface:PropertyAdapter
Returns the field if the property is a public field or null if the property is accessed via the read method.- Specified by:
getField
in interfacePropertyAdapter
-
getDeclaringClass
public java.lang.Class getDeclaringClass()
Description copied from interface:PropertyAdapter
The class in which the property (or public field) is defined.- Specified by:
getDeclaringClass
in interfacePropertyAdapter
-
-