Package com.bobocode.bring.web.utils
Class ParameterTypeUtils
java.lang.Object
com.bobocode.bring.web.utils.ParameterTypeUtils
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 Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Object
parseToParameterType
(String pathVariable, Class<?> type) Parses the given path variable to the specified parameter type.
-
Field Details
-
TRUE
A constant string representing the boolean value "true".- See Also:
-
FALSE
A constant string representing the boolean value "false".- See Also:
-
-
Constructor Details
-
ParameterTypeUtils
public ParameterTypeUtils()
-
-
Method Details
-
parseToParameterType
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.
-