|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.tapestry.util.io.DataSqueezerImpl
public class DataSqueezerImpl
A class used to convert arbitrary objects to Strings and back. This has particular uses involving HTTP URLs and Cookies.
Field Summary | |
---|---|
protected SqueezeAdaptor[] |
_adaptorByPrefix
An array of adaptors; this is used as a cheap lookup-table when unsqueezing. |
protected org.apache.hivemind.lib.util.StrategyRegistry |
_adaptors
AdaptorRegistry cache of adaptors. |
protected static int |
ARRAY_SIZE
|
protected static int |
FIRST_ADAPTOR_OFFSET
|
protected static String |
NULL_PREFIX
|
Constructor Summary | |
---|---|
DataSqueezerImpl()
|
Method Summary | |
---|---|
void |
register(SqueezeAdaptor adaptor)
Registers the adaptor with one or more single-character prefixes. |
void |
setSqueezeAdaptors(List adaptors)
|
String |
squeeze(Object data)
Squeezes the data object into a String by locating an appropriate adaptor that can perform the conversion. |
String[] |
squeeze(Object[] data)
A convience; invokes squeeze(Object) for each element in the data array. |
String |
toString()
|
Object |
unsqueeze(String string)
Unsqueezes the string. |
Object[] |
unsqueeze(String[] strings)
Convienience method for unsqueezing many strings (back into objects). |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected static final String NULL_PREFIX
protected static final int ARRAY_SIZE
protected static final int FIRST_ADAPTOR_OFFSET
protected SqueezeAdaptor[] _adaptorByPrefix
protected org.apache.hivemind.lib.util.StrategyRegistry _adaptors
Constructor Detail |
---|
public DataSqueezerImpl()
Method Detail |
---|
public void setSqueezeAdaptors(List adaptors)
public void register(SqueezeAdaptor adaptor)
Note: This method should be used for testing purposes only! Squeeze adaptors are normally injected by HiveMind.
adaptor
- the adaptor which to be registered.public String squeeze(Object data)
squeeze
in interface DataSqueezer
data
- The object to squeeze.
public String[] squeeze(Object[] data)
squeeze(Object)
for each element in the data array. If data is
null, returns null.
squeeze
in interface DataSqueezer
data
- Array of objects to squeeze.
public Object unsqueeze(String string)
unsqueeze
in interface DataSqueezer
string
- The data to unsqueeze.
DataSqueezer.squeeze(Object)
.public Object[] unsqueeze(String[] strings)
If strings is null, returns null.
unsqueeze
in interface DataSqueezer
strings
- The string data array to unsqueeze.
DataSqueezer.squeeze(Object[])
.public String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |