1 16 package net.sf.dozer.util.mapping.converters; 17 18 import net.sf.dozer.util.mapping.vo.Vehicle; 19 20 24 public class InjectedCustomConverter implements CustomConverter { 25 26 private String injectedName; 27 28 public Object convert(Object destination, Object source, Class destClass, Class sourceClass) { 29 Vehicle rvalue = null; 30 try { 31 rvalue = (Vehicle) destClass.newInstance(); 32 } catch (InstantiationException e) { 33 e.printStackTrace(); 34 } catch (IllegalAccessException e) { 35 e.printStackTrace(); 36 } 37 rvalue.setName(getInjectedName()); 38 return rvalue; 39 } 40 41 public String getInjectedName() { 42 return injectedName; 43 } 44 45 public void setInjectedName(String injectedName) { 46 this.injectedName = injectedName; 47 } 48 49 } 50 | Popular Tags |