Nixed deprecated transformer.
This commit is contained in:
@@ -51,32 +51,6 @@ import com.google.common.collect.Sets;
|
|||||||
*/
|
*/
|
||||||
public class Transformers
|
public class Transformers
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* Combines the contents of a String[] column into a single string, separated by tabs. Any tabs
|
|
||||||
* in the strings will be escaped.
|
|
||||||
*
|
|
||||||
* @deprecated does not encode {} and { "" } differently; cannot handle null.
|
|
||||||
*/
|
|
||||||
@Deprecated public static class TabSeparatedString implements Transformer<String[], String> {
|
|
||||||
public String toPersistent (String[] values) {
|
|
||||||
StringBuffer buf = new StringBuffer();
|
|
||||||
for (String value : values) {
|
|
||||||
if (buf.length() > 0) {
|
|
||||||
buf.append("\t");
|
|
||||||
}
|
|
||||||
buf.append(value.replace("\t", "\\\t"));
|
|
||||||
}
|
|
||||||
return buf.toString();
|
|
||||||
}
|
|
||||||
public String[] fromPersistent (Type ftype, String value) {
|
|
||||||
String[] values = value.replace("\\\t", "%%ESCTAB%%").split("\t");
|
|
||||||
for (int ii = 0; ii < values.length; ii++) {
|
|
||||||
values[ii] = values[ii].replace("%%ESCTAB%%", "\t");
|
|
||||||
}
|
|
||||||
return values;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Combines the contents of a String[] column into a single String, terminating
|
* Combines the contents of a String[] column into a single String, terminating
|
||||||
* each String element with a newline.
|
* each String element with a newline.
|
||||||
|
|||||||
@@ -165,7 +165,7 @@ public class TransformTest extends TestBase
|
|||||||
|
|
||||||
public static class BadTransformRecord extends PersistentRecord
|
public static class BadTransformRecord extends PersistentRecord
|
||||||
{
|
{
|
||||||
@Transform(Transformers.TabSeparatedString.class)
|
@Transform(Transformers.StringArray.class)
|
||||||
public Thread thread;
|
public Thread thread;
|
||||||
|
|
||||||
public InvalidCustomType invalid;
|
public InvalidCustomType invalid;
|
||||||
|
|||||||
Reference in New Issue
Block a user