KickJava   Java API By Example, From Geeks To Geeks.

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


1 package com.thoughtworks.xstream.converters.basic;
2
3 /**
4  * Converts a byte primitive or java.lang.Byre wrapper to
5  * a String.
6  *
7  * @author Joe Walnes
8  */

9 public class ByteConverter extends AbstractBasicConverter {
10
11     public boolean canConvert(Class JavaDoc type) {
12         return type.equals(byte.class) || type.equals(Byte JavaDoc.class);
13     }
14
15     protected Object JavaDoc fromString(String JavaDoc str) {
16         return new Byte JavaDoc((byte) Integer.parseInt(str));
17     }
18
19 }
20
Popular Tags