org.fcrepo.server.rest.param
Class AbstractParam<V>

java.lang.Object
  extended by org.fcrepo.server.rest.param.AbstractParam<V>
Direct Known Subclasses:
DateTimeParam

public abstract class AbstractParam<V>
extends Object

An abstract class for JAX-RS parameter handlers, providing a single String constructor class for annotated QueryParams and PathParams.

Errors during parameter parsing result in a WebApplicationException with a 400 Bad Request status code.

Version:
$Id$
Author:
Coda Hale, Edwin Shin
See Also:
http://codahale.com/what-makes-jersey-interesting-parameter-classes/

Constructor Summary
AbstractParam(String param)
           
 
Method Summary
protected  String getErrorMessage(String param, Throwable e)
           
 String getOriginalParam()
          Get the original constructor parameter.
 V getValue()
          Get the parsed value of the param.
protected  javax.ws.rs.core.Response onError(String param, Throwable e)
          Generates an HTTP 400 (Bad Request)
protected abstract  V parse(String param)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AbstractParam

public AbstractParam(String param)
              throws javax.ws.rs.WebApplicationException
Throws:
javax.ws.rs.WebApplicationException
Method Detail

getValue

public V getValue()
Get the parsed value of the param.

Returns:
the parsed value of param.

getOriginalParam

public String getOriginalParam()
Get the original constructor parameter.

Returns:
the original constructor parameter.

toString

public String toString()
Overrides:
toString in class Object

parse

protected abstract V parse(String param)
                    throws Throwable
Throws:
Throwable

onError

protected javax.ws.rs.core.Response onError(String param,
                                            Throwable e)
Generates an HTTP 400 (Bad Request)

Parameters:
param - the original parameter
e - the original error
Returns:
HTTP 400 Bad Request

getErrorMessage

protected String getErrorMessage(String param,
                                 Throwable e)


Copyright © 2011 DuraSpace. All Rights Reserved.