Class ValueOfFieldHandler

    • Constructor Detail

      • ValueOfFieldHandler

        public ValueOfFieldHandler​(java.lang.Class type)
                            throws MappingException
        Creates a new ValueOfFieldHandler.
        Parameters:
        type - the class type to create the FieldHandler for
        Throws:
        MappingException - if the valueOf method cannot be found
    • Method Detail

      • convertUponGet

        public java.lang.Object convertUponGet​(java.lang.Object value)
        This method is used to convert the value when the getValue method is called. The getValue method will obtain the actual field value from given 'parent' object. This convert method is then invoked with the field's value. The value returned from this method will be the actual value returned by getValue method.
        Specified by:
        convertUponGet in class GeneralizedFieldHandler
        Parameters:
        value - the object value to convert after performing a get operation
        Returns:
        the converted value.
      • convertUponSet

        public java.lang.Object convertUponSet​(java.lang.Object value)
        This method is used to convert the value when the setValue method is called. The setValue method will call this method to obtain the converted value. The converted value will then be used as the value to set for the field.
        Specified by:
        convertUponSet in class GeneralizedFieldHandler
        Parameters:
        value - the object value to convert before performing a set operation
        Returns:
        the converted value.
      • getFieldType

        public java.lang.Class getFieldType()
        Returns the class type for the field that this GeneralizedFieldHandler converts to and from. This should be the type that is used in the object model.
        Specified by:
        getFieldType in class GeneralizedFieldHandler
        Returns:
        the class type of of the field
      • newInstance

        public java.lang.Object newInstance​(java.lang.Object parent)
                                     throws java.lang.IllegalStateException
        Creates a new instance of the object described by this field.
        Specified by:
        newInstance in interface FieldHandler
        Overrides:
        newInstance in class GeneralizedFieldHandler
        Parameters:
        parent - The object for which the field is created
        Returns:
        A new instance of the field's value
        Throws:
        java.lang.IllegalStateException - This field is a simple type and cannot be instantiated