Class MessageParameter<X>
java.lang.Object
org.apache.flink.runtime.rest.messages.MessageParameter<X>
- Direct Known Subclasses:
MessagePathParameter,MessageQueryParameter
This class represents a single path/query parameter that can be used for a request. Every
parameter has an associated key, and a one-time settable value.
Parameters are either mandatory or optional, indicating whether the parameter must be resolved for the request.
All parameters support symmetric conversion from their actual type and string via convertFromString(String) and convertToString(Object). The conversion from X
to string is required on the client to assemble the URL, whereas the conversion from string to
X is required on the server to provide properly typed parameters to the handlers.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static enumEnum for indicating whether a parameter is mandatory or optional. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedMessageParameter(String key, MessageParameter.MessageParameterRequisiteness requisiteness) -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract XconvertFromString(String value) Converts the given string to a valid value of this parameter.protected abstract StringconvertToString(X value) Converts the given value to its string representation.abstract StringReturns a description for REST API HTML documentation.final StringgetKey()Returns the key of this parameter, e.g.final XgetValue()Returns the resolved value of this parameter, ornullif it isn't resolved yet.final booleanReturns whether this parameter must be resolved for the request.final booleanReturns whether this parameter has been resolved.final voidResolves this parameter for the given value.final voidresolveFromString(String value) Resolves this parameter for the given string value representation.
-
Constructor Details
-
MessageParameter
protected MessageParameter(String key, MessageParameter.MessageParameterRequisiteness requisiteness)
-
-
Method Details
-
isResolved
public final boolean isResolved()Returns whether this parameter has been resolved.- Returns:
- true, if this parameter was resolved, false otherwise
-
resolve
Resolves this parameter for the given value.- Parameters:
value- value to resolve this parameter with
-
resolveFromString
Resolves this parameter for the given string value representation.- Parameters:
value- string representation of value to resolve this parameter with- Throws:
ConversionException
-
convertFromString
Converts the given string to a valid value of this parameter.- Parameters:
value- string representation of parameter value- Returns:
- parameter value
- Throws:
ConversionException
-
convertToString
Converts the given value to its string representation.- Parameters:
value- parameter value- Returns:
- string representation of typed value
-
getKey
Returns the key of this parameter, e.g. "jobid".- Returns:
- key of this parameter
-
getValue
Returns the resolved value of this parameter, ornullif it isn't resolved yet.- Returns:
- resolved value, or null if it wasn't resolved yet
-
isMandatory
public final boolean isMandatory()Returns whether this parameter must be resolved for the request.- Returns:
- true if the parameter is mandatory, false otherwise
-
getDescription
Returns a description for REST API HTML documentation.- Returns:
- escaped HTML string
-