1 package org.sapia.gumby.tags.support; 2 3 import org.sapia.gumby.RenderContext; 4 import org.sapia.gumby.factory.ContextAware; 5 import org.sapia.gumby.tags.types.TypeUtil; 6 import org.sapia.util.xml.confix.ConfigurationException; 7 import org.sapia.util.xml.confix.ObjectHandlerIF; 8 9 24 public class Arg implements ObjectHandlerIF, ContextAware { 25 26 private Class _type; 27 private Object _value; 28 private RenderContext _context; 29 30 public void setType(String type) throws Exception { 31 _type = TypeUtil.getTypeFor(type); 32 if(_type == null) { 33 _type = _context.getSettings().resolveClass(type); 34 } 35 } 36 37 public Class getType() { 38 if(_type == null) { 39 if(_value == null) { 40 throw new IllegalStateException ( 41 "Could not determine type; arg value is null"); 42 } 43 return _value.getClass(); 44 } 45 return _type; 46 } 47 48 public void setValue(Object value) { 49 _value = value; 50 } 51 52 public Object getValue() { 53 return _value; 54 } 55 56 59 public void handleContext(RenderContext context) { 60 _context = context; 61 } 62 63 67 public void handleObject(String arg0, Object arg1) 68 throws ConfigurationException { 69 setValue(arg1); 70 } 71 72 } 73 | Popular Tags |