Class MethodProperty

All Implemented Interfaces:
Comparable<Property>

public class MethodProperty extends GenericProperty

A MethodProperty is a Property which is accessed through accessor methods (setX, getX). It is possible to have a MethodProperty which has only setter, only getter, or both. It is not possible to have a MethodProperty which has neither setter nor getter.

  • Field Details

  • Constructor Details

  • Method Details

    • discoverGenericType

      private static Type discoverGenericType(PropertyDescriptor property)
    • set

      public void set(Object object, Object value) throws Exception
      Specified by:
      set in class Property
      Throws:
      Exception
    • get

      public Object get(Object object)
      Specified by:
      get in class Property
    • getAnnotations

      public List<Annotation> getAnnotations()
      Returns the annotations that are present on read and write methods of this property or empty List if there're no annotations.
      Specified by:
      getAnnotations in class Property
      Returns:
      the annotations that are present on this property or empty List if there're no annotations
    • getAnnotation

      public <A extends Annotation> A getAnnotation(Class<A> annotationType)
      Returns property's annotation for the given type or null if it's not present. If the annotation is present on both read and write methods, the annotation on read method takes precedence.
      Specified by:
      getAnnotation in class Property
      Type Parameters:
      A - class of the annotation
      Parameters:
      annotationType - the type of the annotation to be returned
      Returns:
      property's annotation for the given type or null if it's not present
    • isWritable

      public boolean isWritable()
      Overrides:
      isWritable in class Property
    • isReadable

      public boolean isReadable()
      Overrides:
      isReadable in class Property
    • isTransient

      private static boolean isTransient(FeatureDescriptor fd)
    • addPublicFields

      static boolean addPublicFields(Class<?> type, Map<String,Property> properties)
      Introspects given type and adds found properties to properties map.
      Parameters:
      type - the type to introspect
      properties - map to add found properties to
      Returns:
      true if an inaccessible field was found