org.apache.tapestry.util.io
Interface SqueezeAdaptor

All Known Implementing Classes:
BooleanAdaptor, ByteAdaptor, CharacterAdaptor, ComponentAddressAdaptor, DoubleAdaptor, FloatAdaptor, IntegerAdaptor, LongAdaptor, SerializableAdaptor, ShortAdaptor, SimpleTableStateAdaptor, StringAdaptor

public interface SqueezeAdaptor

Interface which defines a class used to convert data for a specific Java type into a String format (squeeze it), or convert from a String back into a Java type (unsqueeze).

This interface is somewhat misnamed; this is more of the GoF Strategy pattern than GoF Adaptor pattern.

Author:
Howard Lewis Ship

Method Summary
 Class getDataClass()
          Returns the class (or interface) which can be encoded by this adaptor.
 String getPrefix()
          Returns one or more characters, each of which will be a prefix for this adaptor.
 String squeeze(DataSqueezer squeezer, Object data)
          Converts the data object into a String.
 Object unsqueeze(DataSqueezer squeezer, String string)
          Converts a String back into an appropriate object.
 

Method Detail

getPrefix

String getPrefix()
Returns one or more characters, each of which will be a prefix for this adaptor.

Returns:
The prefix for this squeezer.

getDataClass

Class getDataClass()
Returns the class (or interface) which can be encoded by this adaptor.

Returns:
The class type that this adaptor can manage.

squeeze

String squeeze(DataSqueezer squeezer,
               Object data)
Converts the data object into a String.

Parameters:
squeezer - The squeezer that should be used to ultimately squeeze the data.
data - The data to squeeze.
Returns:
String representation of data.

unsqueeze

Object unsqueeze(DataSqueezer squeezer,
                 String string)
Converts a String back into an appropriate object.

Parameters:
squeezer - The squeezer to use to unsqueeze the data.
string - The string data - as was returned from squeeze(org.apache.tapestry.services.DataSqueezer, Object).
Returns:
The re-constituded object representation of the string.


Copyright © 2006-2008 Apache Software Foundation. All Rights Reserved.