Class ParameterTypeUtils

java.lang.Object
com.bobocode.bring.web.utils.ParameterTypeUtils

public class ParameterTypeUtils extends Object
The ParameterTypeUtils class is a utility class that provides methods for parsing path variables to their corresponding parameter types.
Since:
1.0
Author:
Blyzhnytsia Team
  • Field Details

  • Constructor Details

    • ParameterTypeUtils

      public ParameterTypeUtils()
  • Method Details

    • parseToParameterType

      public static Object parseToParameterType(String pathVariable, Class<?> type)
      Parses the given path variable to the specified parameter type.
      Parameters:
      pathVariable - The string representation of the path variable.
      type - The target parameter type to parse the path variable into.
      Returns:
      An object of the specified parameter type representing the parsed path variable.
      Throws:
      MethodArgumentTypeMismatchException - if the path variable cannot be converted to the required type.
      TypeArgumentUnsupportedException - if the specified parameter type is not supported.