Class FieldPropertyDescriptor


  • public class FieldPropertyDescriptor
    extends BeanPropertyDescriptor
    Author:
    Glen Daniels (gdaniels@apache.org)
    • Constructor Summary

      Constructors 
      Constructor Description
      FieldPropertyDescriptor​(java.lang.String _name, java.lang.reflect.Field _field)
      Construct a BPD with a field Both must be set
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.Object get​(java.lang.Object obj)
      Get the property value
      java.lang.Object get​(java.lang.Object obj, int i)
      Get an indexed property
      java.lang.Class getActualType()  
      java.lang.reflect.Field getField()  
      java.lang.String getName()
      Get our property name.
      java.lang.Class getType()
      Get the type of a property
      boolean isIndexed()
      Query if property is indexed.
      boolean isReadable()
      Query if property is readable
      boolean isWriteable()
      Query if property is writeable
      void set​(java.lang.Object obj, int i, java.lang.Object newValue)
      Set an indexed property value
      void set​(java.lang.Object obj, java.lang.Object newValue)
      Set the property value
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • FieldPropertyDescriptor

        public FieldPropertyDescriptor​(java.lang.String _name,
                                       java.lang.reflect.Field _field)
        Construct a BPD with a field Both must be set
        Parameters:
        _name - is the name of the property
        _field - is the name of the public instance field
    • Method Detail

      • isIndexed

        public boolean isIndexed()
        Query if property is indexed. Indexed properties require valid setters/getters
        Overrides:
        isIndexed in class BeanPropertyDescriptor
        Returns:
        true if indexed methods exist
      • get

        public java.lang.Object get​(java.lang.Object obj)
                             throws java.lang.reflect.InvocationTargetException,
                                    java.lang.IllegalAccessException
        Get the property value
        Overrides:
        get in class BeanPropertyDescriptor
        Parameters:
        obj - is the object
        Returns:
        the entire propery value
        Throws:
        java.lang.reflect.InvocationTargetException
        java.lang.IllegalAccessException
      • set

        public void set​(java.lang.Object obj,
                        java.lang.Object newValue)
                 throws java.lang.reflect.InvocationTargetException,
                        java.lang.IllegalAccessException
        Set the property value
        Overrides:
        set in class BeanPropertyDescriptor
        Parameters:
        obj - is the object
        newValue - is the new value
        Throws:
        java.lang.reflect.InvocationTargetException
        java.lang.IllegalAccessException
      • get

        public java.lang.Object get​(java.lang.Object obj,
                                    int i)
                             throws java.lang.reflect.InvocationTargetException,
                                    java.lang.IllegalAccessException
        Get an indexed property
        Overrides:
        get in class BeanPropertyDescriptor
        Parameters:
        obj - is the object
        i - the index
        Returns:
        the object at the indicated index
        Throws:
        java.lang.reflect.InvocationTargetException
        java.lang.IllegalAccessException
      • set

        public void set​(java.lang.Object obj,
                        int i,
                        java.lang.Object newValue)
                 throws java.lang.reflect.InvocationTargetException,
                        java.lang.IllegalAccessException
        Set an indexed property value
        Overrides:
        set in class BeanPropertyDescriptor
        Parameters:
        obj - is the object
        i - the index
        newValue - is the new value
        Throws:
        java.lang.reflect.InvocationTargetException
        java.lang.IllegalAccessException
      • getType

        public java.lang.Class getType()
        Get the type of a property
        Overrides:
        getType in class BeanPropertyDescriptor
        Returns:
        the type of the property
      • getField

        public java.lang.reflect.Field getField()