public interface ResponseCoercer
  • Method Summary

    Modifier and Type
    Method
    Description
    dev.mccue.microhttp.handler.IntoResponse
    coerce(Method method, Object o)
    Coerce the value returned by a Method into an IntoResponse.
  • Method Details

    • coerce

      dev.mccue.microhttp.handler.IntoResponse coerce(Method method, Object o) throws Exception
      Coerce the value returned by a Method into an IntoResponse.

      If this is not doable, it is expected that an Exception will be thrown.

      If that Exception is an instance of IntoResponse then that can be used to give a specific error to the user.

      Parameters:
      method - The method that was called. Can be inspected for annotations and declared return type.
      o - The object returned from the method.
      Returns:
      An instance of IntoResponse
      Throws:
      Exception