1 29 30 package com.caucho.config; 31 32 import com.caucho.util.L10N; 33 import com.caucho.xml.QName; 34 35 import org.w3c.dom.Node ; 36 37 40 public abstract class TypeStrategy { 41 protected static final L10N L = new L10N(TypeStrategy.class); 42 43 46 public String getTypeName() 47 { 48 return getClass().getName(); 49 } 50 51 54 public Object create() 55 throws Exception 56 { 57 throw new UnsupportedOperationException (getClass().getName()); 58 } 59 60 65 public void setParent(Object bean, Object parent) 66 throws Exception 67 { 68 } 69 70 76 public AttributeStrategy getAttributeStrategy(QName attrName) 77 throws Exception 78 { 79 throw new ConfigException(L.l("'{0}' is an unknown attribute of {1}.", 80 attrName.getName(), 81 getTypeName())); 82 } 83 84 91 abstract public Object configure(NodeBuilder builder, Node node, Object parent) 92 throws Exception ; 93 94 101 public void configureBean(NodeBuilder builder, Object bean, Node top) 102 throws Exception 103 { 104 builder.configureBeanImpl(this, bean, top); 105 } 106 107 110 public void configureAttribute(NodeBuilder builder, Object bean, Node attr) 111 throws Exception 112 { 113 builder.configureAttributeImpl(this, bean, attr); 114 } 115 116 119 public void init(Object bean) 120 throws Exception 121 { 122 } 123 124 127 public Object replaceObject(Object bean) 128 throws Exception 129 { 130 return bean; 131 } 132 } 133 | Popular Tags |