T - the type of value wrapped by the parameterpublic abstract class AbstractParam<T> extends Object
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractParam(String input)
Given an input value from a client, creates a parameter wrapping its parsed value.
|
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)
Deprecated.
instead of returning a
Response from this method, subclasses should override
errorMessage(java.lang.Exception) and getErrorStatus() to allow a WebApplicationException to be thrown
which is mapped to a response using the exception mappers. |
protected String |
errorMessage(Exception e)
Given a string representation which was unable to be parsed and the exception thrown, produce
an error message to be sent to the client.
|
protected ErrorMessage |
generateErrorMessage(String input,
Exception e)
Generates an
ErrorMessage to return 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()
Deprecated.
the media type should be set by the exception mapper instead
|
protected abstract T |
parse(String input)
Given a string representation, parse it and return an instance of the parameter type.
|
String |
toString() |
protected AbstractParam(@Nullable String input)
input - an input value from a client request, might be nullprotected AbstractParam(@Nullable String input, String parameterName)
input - an input value from a client request, might be nullparameterName - name of the parameter with the provided valueprotected ErrorMessage generateErrorMessage(@Nullable String input, Exception e)
ErrorMessage to return to the client.input - the raw input valuee - the exception thrown while parsing inputErrorMessage with the message and status to return to the client@Nullable @Deprecated protected javax.ws.rs.core.Response error(@Nullable String input, Exception e)
Response from this method, subclasses should override
errorMessage(java.lang.Exception) and getErrorStatus() to allow a WebApplicationException to be thrown
which is mapped to a response using the exception mappers.WebApplicationException that contains a response with an entity,
AbstractParam now throws a WebApplicationException that contains a message and status code,
and can be mapped to a response using exception mappers. This method is kept for backwards compatibility with
user-defined AbstractParam implementations that implement custom error behavior by overriding this method.
Given a string representation which was unable to be parsed and the exception thrown, produce
a Response to be sent to the client.
input - the raw input valuee - the exception thrown while parsing inputResponse to be sent to the client, or null to allow AbstractParam to throw
a WebApplicationException that contains a message and status code.@Deprecated protected javax.ws.rs.core.MediaType mediaType()
protected String errorMessage(Exception e)
e - the exception thrown while parsing inputprotected 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 TException - if there is an error parsing the inputpublic T get()
Copyright © 2011. All rights reserved.