Class FieldInstance


  • public class FieldInstance
    extends java.lang.Object
    A FieldInstance refers to a specific reflected field on an object.
    Version:
    $Revision$
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.lang.reflect.Field field
      Field
      protected java.lang.Object instance
      Instance
    • Constructor Summary

      Constructors 
      Constructor Description
      FieldInstance​(java.lang.Object instance, java.lang.String fieldName)
      Construct a new field instance.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.Object get()
      Get the value of the field instance.
      java.lang.reflect.Field getField()
      Get the field.
      java.lang.Object getInstance()
      Get the instance.
      void set​(java.lang.Object value)
      Set the value of the field instance
      • Methods inherited from class java.lang.Object

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

      • field

        protected final java.lang.reflect.Field field
        Field
      • instance

        protected final java.lang.Object instance
        Instance
    • Constructor Detail

      • FieldInstance

        public FieldInstance​(java.lang.Object instance,
                             java.lang.String fieldName)
                      throws java.lang.NoSuchFieldException
        Construct a new field instance.
        Parameters:
        instance - The instance object the given field belongs to.
        fieldName - The name of the field to find in the instance.
        Throws:
        NullArgumentException - Instance or fieldName is null.
        java.lang.NoSuchFieldException
    • Method Detail

      • getField

        public final java.lang.reflect.Field getField()
        Get the field.
        Returns:
        Field.
      • getInstance

        public final java.lang.Object getInstance()
        Get the instance.
        Returns:
        Instance.
      • get

        public final java.lang.Object get()
                                   throws java.lang.IllegalAccessException
        Get the value of the field instance.
        Returns:
        Field value.
        Throws:
        java.lang.IllegalAccessException - Failed to get field value.
      • set

        public final void set​(java.lang.Object value)
                       throws java.lang.IllegalAccessException
        Set the value of the field instance
        Parameters:
        value - Field value.
        Throws:
        java.lang.IllegalAccessException - Failed to set field value.