Interface PropertyHandler

All Known Implementing Classes:
DatePropertyHandler, StringEnumPropertyHandler

public interface PropertyHandler
Interface to define how implementations can interact with property handling when constructing a bean from a ResultSet. PropertyHandlers do the work of coercing a value into the target type required.
  • Method Summary

    Modifier and Type
    Method
    Description
    apply(Class<?> parameter, Object value)
    Do the work required to store value into something of type parameter.
    boolean
    match(Class<?> parameter, Object value)
    Test whether this PropertyHandler wants to handle setting value into something of type parameter.
  • Method Details

    • match

      boolean match(Class<?> parameter, Object value)
      Test whether this PropertyHandler wants to handle setting value into something of type 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.
    • apply

      Object apply(Class<?> parameter, Object value)
      Do the work required to store value into something of type parameter. This method is called only if this handler responded true after a call to match(Class, Object).
      Parameters:
      parameter - The type of the target parameter.
      value - The value to be set.
      Returns:
      The converted value or the original value if something doesn't work out.