Class FuzzyEnumParamConverter<T>

java.lang.Object
io.dropwizard.jersey.validation.FuzzyEnumParamConverter<T>
All Implemented Interfaces:
jakarta.ws.rs.ext.ParamConverter<T>

@Provider public class FuzzyEnumParamConverter<T> extends Object implements jakarta.ws.rs.ext.ParamConverter<T>
Provides converters to jersey for enums used as resource parameters.

By default jersey will return a 404 if a resource parameter of an enum type cannot be converted. This class provides converters for all enum types used as resource parameters that provide better error handling. If an invalid value is provided for the parameter a 400 Bad Request is returned and the error message will include the parameter name and a list of valid values.

Since:
2.0
  • Method Details

    • fromString

      public @Nullable T fromString(String value)
      Specified by:
      fromString in interface jakarta.ws.rs.ext.ParamConverter<T>
    • toString

      public String toString(T value)
      Specified by:
      toString in interface jakarta.ws.rs.ext.ParamConverter<T>