1 9 10 package org.jboss.util.coerce; 11 12 import org.jboss.util.CoercionException; 13 import org.jboss.util.NotCoercibleException; 14 15 import java.io.File ; 16 17 23 public class FileHandler 24 extends BoundCoercionHandler 25 { 26 31 public Class getType() { 32 return File .class; 33 } 34 35 47 public Object coerce(Object value, Class type) throws CoercionException { 48 if (value.getClass().equals(String .class)) { 49 return coerce((String )value); 50 } 51 52 throw new NotCoercibleException(value); 53 } 54 55 64 public Object coerce(String value) { 65 return new File (value); 66 } 67 } 68 69 | Popular Tags |