1 package com.opensymphony.webwork.util; 2 3 import ognl.DefaultTypeConverter; 4 5 import java.util.Map ; 6 7 15 public abstract class WebWorkTypeConverter extends DefaultTypeConverter { 16 public Object convertValue(Map context, Object o, Class toClass) { 17 if (toClass.equals(String .class)) { 18 return convertToString(context, o); 19 } else if (o instanceof String []) { 20 return convertFromString(context, (String []) o, toClass); 21 } else if (o instanceof String ) { 22 return convertFromString(context, new String []{(String ) o}, toClass); 23 } else { 24 return super.convertValue(context, o, toClass); 25 } 26 } 27 28 36 public abstract Object convertFromString(Map context, String [] values, Class toClass); 37 38 45 public abstract String convertToString(Map context, Object o); 46 } 47 | Popular Tags |