1 16 17 package org.apache.commons.jelly; 18 19 import org.apache.commons.beanutils.DynaBean; 20 import org.apache.commons.beanutils.DynaProperty; 21 22 31 32 public abstract class DynaBeanTagSupport extends DynaTagSupport { 33 34 35 private DynaBean dynaBean; 36 37 public DynaBeanTagSupport() { 38 } 39 40 public DynaBeanTagSupport(DynaBean dynaBean) { 41 this.dynaBean = dynaBean; 42 } 43 44 45 public void setContext(JellyContext context) throws JellyTagException { 46 this.context = context; 47 beforeSetAttributes(); 48 } 49 50 52 public void setAttribute(String name, Object value) throws JellyTagException { 53 getDynaBean().set(name, value); 54 } 55 56 60 public Class getAttributeType(String name) throws JellyTagException { 61 DynaProperty property = getDynaBean().getDynaClass().getDynaProperty(name); 62 if (property != null) { 63 return property.getType(); 64 } 65 return Object .class; 66 } 67 68 72 public DynaBean getDynaBean() { 73 return dynaBean; 74 } 75 76 80 public void setDynaBean(DynaBean dynaBean) { 81 this.dynaBean = dynaBean; 82 } 83 84 87 public void beforeSetAttributes() throws JellyTagException { 88 } 89 90 } 91 | Popular Tags |