1 28 29 package com.caucho.config; 30 31 import com.caucho.util.L10N; 32 33 import java.lang.reflect.Method ; 34 35 38 public class ProgramPropertyStrategy extends AttributeStrategy { 39 static L10N L = new L10N(ProgramPropertyStrategy.class); 40 41 private final Method _setter; 42 private String _name; 43 44 public ProgramPropertyStrategy(Method setter) 45 throws BeanBuilderException 46 { 47 _setter = setter; 48 } 49 50 public Method getMethod() 51 { 52 return _setter; 53 } 54 55 public void setString(Object bean, String value) 56 throws BeanBuilderException 57 { 58 try { 59 if (value == null) { 60 setNull(bean); 61 return; 62 } 63 64 _setter.invoke(bean, new Object [] { _name, evalString(value) }); 65 } catch (Exception e) { 66 throw new BeanBuilderException(e); 67 } 68 } 69 70 private void setNull(Object bean) 71 throws Exception 72 { 73 _setter.invoke(bean, new Object [] { _name, null }); 74 } 75 } 76 | Popular Tags |