Interface ValueSetErrorCallback

  • All Known Implementing Classes:
    ActionHarness.DefaultActionCallback, ActionHarness.VarArgsWrapperCallback, BeanUtil.EagerFailingCallback

    public interface ValueSetErrorCallback
    This interface is used in conjunction with BeanUtil#setValue(Object, String, ValueSetCallback, PropertyNameFormatter...) to give the developer full control of how to handle various events that occur during the attempt to set a value on a Java Bean. Using a callback allows us to always employ the same logic when syncing data to a bean (since that are loads of different ways to do this just in commons-beanutils).
    See Also:
    BeanUtil#setValue(Object, String, ValueSetCallback, PropertyNameFormatter...)
    • Method Detail

      • failedToSetValue

        void failedToSetValue​(Object bean,
                              String propertyName,
                              Object value,
                              String beanPropertyType,
                              Throwable cause)
                       throws Exception
        Fired when the bean utility failed to set a value on your bean.
        bean - the bean on which the value set operation was attempted
        propertyName - the name of the property that failed to set on the bean
        value - the value that the bean utility attempted to set on the bean
        beanPropertyType - the type of the bean property on which we tried to set the value. This may not be the same type as that of the value.
        cause - the reason for the failure
        ActionExecutionException - throw this exception if you consider this a terminal condition
      • propertyNotWritable

        void propertyNotWritable​(Object bean,
                                 String propertyName)
                          throws Exception
        Fired if, prior to the value being set, the write-check on the property fails.
        bean - the bean on which write test was performed
        propertyName - the name of the property that is not writable on the bean
        Exception - throw an exception if you consider this to be a terminal condition