1 26 27 package org.nightlabs.editor2d.iofilter.xstream; 28 29 import org.nightlabs.editor2d.impl.Editor2DFactoryImpl; 30 import org.nightlabs.editor2d.j2d.GeneralShape; 31 import com.thoughtworks.xstream.converters.basic.AbstractBasicConverter; 32 33 public class GeneralShapeConverter 34 extends AbstractBasicConverter 35 { 36 protected Editor2DFactoryImpl factory; 37 public GeneralShapeConverter() { 38 super(); 39 factory = new Editor2DFactoryImpl(); 40 } 41 42 protected Object fromString(String str) { 43 return factory.createGeneralShapeFromString(str); 44 } 45 46 protected String toString(Object obj) { 47 return factory.convertGeneralShapeToString(obj); 48 } 49 50 public boolean canConvert(Class type) 51 { 52 if (type.equals(GeneralShape.class)) 53 return true; 54 55 return false; 56 } 57 58 } 59 | Popular Tags |