Interface PropertyHandler

  • All Known Implementing Classes:
    DatePropertyHandler, StringEnumPropertyHandler

    public interface PropertyHandler
    Defines how to handle properties when constructing a bean from a ResultSet. Instances coerce values into a target types.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      java.lang.Object apply​(java.lang.Class<?> parameter, java.lang.Object value)
      Stores the given value into an instance of type parameter.
      boolean match​(java.lang.Class<?> parameter, java.lang.Object value)
      Tests whether to handle setting value into an instance of parameter.
    • Method Detail

      • apply

        java.lang.Object apply​(java.lang.Class<?> parameter,
                               java.lang.Object value)
        Stores the given value into an instance of type parameter. This method is only called if match(Class, Object) return true.
        Parameters:
        parameter - The type of the target parameter.
        value - The value to set.
        Returns:
        The converted value or the original value if something doesn't work out.
      • match

        boolean match​(java.lang.Class<?> parameter,
                      java.lang.Object value)
        Tests whether to handle setting value into an instance of parameter.
        Parameters:
        parameter - The type of the target parameter.
        value - The value to be set.
        Returns:
        true is this property handler can/wants to handle this value; false otherwise.