Package org.apache.tapestry5.beanmodel.internal.services

# 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

  Modifier and Type
  Method
  Description
  `Object`
  `get(Object instance)`
  Reads the property value.
  `<T extends Annotation>
  T`
  `getAnnotation(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 the `ClassPropertyAdapter` 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.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Method Details

  - ### getName

    public String getName()
    Description copied from interface: `PropertyAdapter`
    Returns the name of the property (or public field).
    Specified by:
      `getName` in interface `PropertyAdapter`

  - ### 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 interface `PropertyAdapter`

  - ### getType

    public Class getType()
    Description copied from interface: `PropertyAdapter`
    Returns the type of the property.
    Specified by:
      `getType` in interface `PropertyAdapter`

  - ### 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 interface `PropertyAdapter`

  - ### 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 interface `PropertyAdapter`

  - ### 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 interface `PropertyAdapter`

  - ### get

    public Object get(Object instance)
    Description copied from interface: `PropertyAdapter`
    Reads the property value.
    Specified by:
      `get` in interface `PropertyAdapter`
    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 interface `PropertyAdapter`
    Parameters:
      `instance` - to update
      `value` - 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 interface `AnnotationProvider`
    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 interface `PropertyAdapter`

  - ### getClassAdapter

    public ClassPropertyAdapter getClassAdapter()
    Description copied from interface: `PropertyAdapter`
    Returns the `ClassPropertyAdapter` that provides access to other properties defined by the same class.
    Specified by:
      `getClassAdapter` in interface `PropertyAdapter`

  - ### getBeanType

    public Class getBeanType()
    Description copied from interface: `PropertyAdapter`
    Returns the type of bean to which this property belongs. This is the same as `ClassPropertyAdapter.getBeanType()`.
    Specified by:
      `getBeanType` in interface `PropertyAdapter`

  - ### 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 interface `PropertyAdapter`

  - ### 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 interface `PropertyAdapter`

  - ### getDeclaringClass

    public Class getDeclaringClass()
    Description copied from interface: `PropertyAdapter`
    The class in which the property (or public field) is defined.
    Specified by:
      `getDeclaringClass` in interface `PropertyAdapter`