KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > hudson > util > StringConverter2


1 package hudson.util;
2
3 import com.thoughtworks.xstream.converters.basic.AbstractBasicConverter;
4 import com.thoughtworks.xstream.converters.basic.StringConverter;
5
6 /**
7  * The default {@link StringConverter} in XStream
8  * uses {@link String#intern()}, which stresses the
9  * (rather limited) PermGen space with a large XML file.
10  *
11  * <p>
12  * Use this to avoid that (instead those strings will
13  * now be allocated to the heap space.)
14  *
15  * @author Kohsuke Kawaguchi
16  */

17 public class StringConverter2 extends AbstractBasicConverter {
18
19     public boolean canConvert(Class JavaDoc type) {
20         return type.equals(String JavaDoc.class);
21     }
22
23     protected Object JavaDoc fromString(String JavaDoc str) {
24         return str;
25     }
26
27 }
28
Popular Tags