org.apache.tapestry.util.io
Interface ISqueezeAdaptor

All Known Implementing Classes:
CharacterAdaptor, ComponentAddressAdaptor, EnumAdaptor

public interface ISqueezeAdaptor

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
 void register(DataSqueezer squeezer)
          Invoked to ask an adaptor to register itself to the squeezer.
 java.lang.String squeeze(DataSqueezer squeezer, java.lang.Object data)
          Converts the data object into a String.
 java.lang.Object unsqueeze(DataSqueezer squeezer, java.lang.String string)
          Converts a String back into an appropriate object.
 

Method Detail

squeeze

public java.lang.String squeeze(DataSqueezer squeezer,
                                java.lang.Object data)
                         throws java.io.IOException
Converts the data object into a String.

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

unsqueeze

public java.lang.Object unsqueeze(DataSqueezer squeezer,
                                  java.lang.String string)
                           throws java.io.IOException
Converts a String back into an appropriate object.

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

register

public void register(DataSqueezer squeezer)
Invoked to ask an adaptor to register itself to the squeezer.