org.apache.tapestry.util.io
Interface SqueezeAdaptor

All Known Implementing Classes:
BooleanAdaptor, ByteAdaptor, CharacterAdaptor, ComponentAddressAdaptor, DoubleAdaptor, FloatAdaptor, IntegerAdaptor, LongAdaptor, SerializableAdaptor, ShortAdaptor, 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.


getDataClass

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


squeeze

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

Throws:
IOException - if the object can't be converted.

unsqueeze

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

Throws:
IOException - if the String can't be converted.


Copyright © 2006 Apache Software Foundation. All Rights Reserved.