org.glassfish.jersey.server.internal.routing
Class TransformableData<DATA,RESULT>

java.lang.Object
  extended by org.glassfish.jersey.server.internal.routing.TransformableData<DATA,RESULT>
Type Parameters:
DATA - data type.
RESULT - result type.

public final class TransformableData<DATA,RESULT>
extends Object

Contains the reference to data as well as an (optional) inflector that may be used to transform the data into a result.

Author:
Marek Potociar (marek.potociar at oracle.com)

Method Summary
 DATA data()
          Get the transformable data.
 boolean hasInflector()
          Check if there is an inflector available to process the data.
 Inflector<DATA,RESULT> inflector()
          Get the inflector transforming the data to the result.
static
<REQUEST,RESPONSE>
TransformableData<REQUEST,RESPONSE>
of(REQUEST data)
          Create a new transformable data instance, but with the inflector not present.
static
<REQUEST,RESPONSE>
TransformableData<REQUEST,RESPONSE>
of(REQUEST data, Inflector<REQUEST,RESPONSE> inflector)
          Create a new transformable data with an inflector instance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

of

public static <REQUEST,RESPONSE> TransformableData<REQUEST,RESPONSE> of(REQUEST data,
                                                                        Inflector<REQUEST,RESPONSE> inflector)
Create a new transformable data with an inflector instance.

Type Parameters:
REQUEST - data type.
RESPONSE - result type.
Parameters:
data - transformable data.
inflector - data to result data transformation. May be {code null} if not available.
Returns:
new transformable data with an inflector instance.

of

public static <REQUEST,RESPONSE> TransformableData<REQUEST,RESPONSE> of(REQUEST data)
Create a new transformable data instance, but with the inflector not present.

Type Parameters:
REQUEST - data type.
RESPONSE - result type.
Parameters:
data - transformable data.
Returns:
new transformable data with null inflector instance.

data

public DATA data()
Get the transformable data.

Returns:
transformable data.

inflector

public Inflector<DATA,RESULT> inflector()
Get the inflector transforming the data to the result. May return null if the inflector is not available.

Returns:
data to result transformation or null if not available.

hasInflector

public boolean hasInflector()
Check if there is an inflector available to process the data.

The absence of an inflector indicates that there was no suitable inflector found for the data.

Returns:
true if there is a transforming inflector available for the data, false otherwise.


Copyright © 2007-2012 Oracle Corporation. All Rights Reserved. Use is subject to license terms.