Class PathArgument
java.lang.Object
io.github.grumpystuff.grumpyrest.request.PathArgument
A concrete argument that was bound to a path parameter. This class contains the argument in its text form, not yet
converted to a high-level / application type, and offers methods to perform this conversion. Instances of this
class only exist for path parameters, not for fixed (literal) segments of a mounted route.
-
Constructor Summary
ConstructorsConstructorDescriptionPathArgument(String name, String text, ParseFromStringService parseFromStringService) NOT PUBLIC API -
Method Summary
Modifier and TypeMethodDescriptiongetName()Getter for the name of the path parameter.getText()Getter for the textual value of the path argument<T> TConverts the path argument to the specified type.<T> TConverts the path argument to the specified class type.Converts the path argument to the specified type.
-
Constructor Details
-
PathArgument
NOT PUBLIC API- Parameters:
name- ...text- ...parseFromStringService- ...
-
-
Method Details
-
getName
Getter for the name of the path parameter.- Returns:
- the name of the path parameter
-
getText
Getter for the textual value of the path argument- Returns:
- the path argument text
-
getValue
Converts the path argument to the specified class type.- Type Parameters:
T- the static type of the class- Parameters:
clazz- the class to convert to- Returns:
- the converted value
- Throws:
PathArgumentParseException- if conversion fails because the path argument does not conform to the expected format according to the type to convert to
-
getValue
Converts the path argument to the specified type.- Type Parameters:
T- the static type to convert to- Parameters:
typeToken- a type token for the type to convert to- Returns:
- the converted value
- Throws:
PathArgumentParseException- if conversion fails because the path argument does not conform to the expected format according to the type to convert to
-
getValue
Converts the path argument to the specified type.- Parameters:
type- the type to convert to- Returns:
- the converted value
- Throws:
PathArgumentParseException- if conversion fails because the path argument does not conform to the expected format according to the type to convert to
-