KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > thoughtworks > xstream > converters > basic > StringConverter


1 package com.thoughtworks.xstream.converters.basic;
2
3 /**
4  * Converts a String to a String ;). Well ok, it doesn't
5  * <i>actually</i> do any conversion.
6  * <p/>
7  * <p>The converter always calls intern() on the returned
8  * String to encourage the JVM to reuse instances.</p>
9  *
10  * @author Joe Walnes
11  * @see String#intern()
12  */

13 public class StringConverter extends AbstractBasicConverter {
14
15     public boolean canConvert(Class JavaDoc type) {
16         return type.equals(String JavaDoc.class);
17     }
18
19     protected Object JavaDoc fromString(String JavaDoc str) {
20         return str.intern();
21     }
22
23 }
24
Popular Tags