1 53 package org.swixml.converters; 54 55 import org.jdom.Attribute; 56 import org.swixml.Converter; 57 import org.swixml.Parser; 58 import org.swixml.Localizer; 59 60 61 70 public class StringConverter implements Converter { 71 72 public static final Class TEMPLATE = String .class; 73 74 82 public Object convert( Class type, final Attribute attr, Localizer localizer ) throws Exception { 83 if ( Parser.LOCALIZED_ATTRIBUTES.contains( attr.getName().toLowerCase() )) 87 if (attr.getAttributeType() == Attribute.CDATA_TYPE ) 88 return localizer.getString( attr.getValue() ); 89 return attr.getValue(); 90 } 91 92 97 public Class convertsTo() { 98 return TEMPLATE; 99 } 100 } 101 | Popular Tags |