T
- the type of value wrapped by the parameterpublic abstract class AbstractParam<T> extends Object
Modifier | Constructor and Description |
---|---|
protected |
AbstractParam(String input) |
protected |
AbstractParam(String input,
String parameterName)
Given an input value from a client, creates a parameter wrapping its parsed value.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj) |
protected javax.ws.rs.core.Response |
error(String input,
Exception e)
Given a string representation which was unable to be parsed and the exception thrown, produce
a
Response to be sent to the client. |
protected String |
errorMessage(Exception e)
Given a string representation which was unable to be parsed and the exception thrown, produce
an entity to be sent to the client.
|
T |
get()
Returns the underlying value.
|
protected javax.ws.rs.core.Response.Status |
getErrorStatus()
Given a string representation which was unable to be parsed, produce a
Response.Status for the
Response to be sent to the client. |
int |
hashCode() |
protected javax.ws.rs.core.MediaType |
mediaType()
Returns the media type of the error message entity.
|
protected abstract T |
parse(String input)
Given a string representation, parse it and return an instance of the parameter type.
|
String |
toString() |
protected javax.ws.rs.core.Response error(@Nullable String input, Exception e)
Response
to be sent to the client.
By default, generates a 400 Bad Request
with a plain text entity generated by
errorMessage(Exception)
.input
- the raw input valuee
- the exception thrown while parsing input
Response
to be sent to the clientprotected javax.ws.rs.core.MediaType mediaType()
protected String errorMessage(Exception e)
e
- the exception thrown while parsing input
protected javax.ws.rs.core.Response.Status getErrorStatus()
Response.Status
for the
Response
to be sent to the client.Response.Status
of the error messageprotected abstract T parse(@Nullable String input) throws Exception
input
- the raw inputinput
, parsed as an instance of T
Exception
- if there is an error parsing the inputpublic T get()
Copyright © 2019. All rights reserved.