1 16 package org.apache.commons.betwixt.strategy; 17 18 import org.apache.commons.beanutils.ConvertUtils; 19 import org.apache.commons.betwixt.expression.Context; 20 21 27 public class ConvertUtilsObjectStringConverter extends ObjectStringConverter { 28 29 39 public String objectToString(Object object, Class type, String flavour, Context context) { 40 if ( object != null ) { 41 String text = ConvertUtils.convert( object ); 42 if ( text != null ) { 43 return text; 44 } 45 } 46 return ""; 47 } 48 49 60 public Object stringToObject(String value, Class type, String flavour, Context context) { 61 if (value == null || "".equals(value)) 62 { 63 return null; 64 } 65 66 return ConvertUtils.convert( value, type ); 67 } 68 } 69 | Popular Tags |