Class PropertyAdapterImpl
- java.lang.Object
-
- org.apache.tapestry5.beanmodel.internal.services.PropertyAdapterImpl
-
- All Implemented Interfaces:
AnnotationProvider
,PropertyAdapter
public class PropertyAdapterImpl extends Object implements PropertyAdapter
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Object
get(Object instance)
Reads the property value.<T extends Annotation>
TgetAnnotation(Class<T> annotationClass)
Searches for the specified annotation, returning the matching annotation instance.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.Class
getDeclaringClass()
The class in which the property (or public field) is defined.Field
getField()
Returns the field if the property is a public field or null if the property is accessed via the read method.String
getName()
Returns the name of the property (or public field).Method
getReadMethod()
Returns the method used to read the property, or null if the property is not readable (or is a public field).Class
getType()
Returns the type of the property.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(Object instance, Object value)
Updates the property value.
-
-
-
Method Detail
-
getName
public String getName()
Description copied from interface:PropertyAdapter
Returns the name of the property (or public field).- Specified by:
getName
in interfacePropertyAdapter
-
getReadMethod
public 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 Class getType()
Description copied from interface:PropertyAdapter
Returns the type of the property.- Specified by:
getType
in interfacePropertyAdapter
-
getWriteMethod
public 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 Object get(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(Object instance, 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 Annotation> T getAnnotation(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 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 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 Class getDeclaringClass()
Description copied from interface:PropertyAdapter
The class in which the property (or public field) is defined.- Specified by:
getDeclaringClass
in interfacePropertyAdapter
-
-