Changeset 13
- Timestamp:
- 07/20/05 18:03:16 (3 years ago)
- Files:
-
- trunk/src/net/schst/XJConf/AttributeDefinition.java (modified) (1 diff)
- trunk/src/net/schst/XJConf/Definition.java (modified) (1 diff)
- trunk/src/net/schst/XJConf/Tag.java (modified) (1 diff)
- trunk/src/net/schst/XJConf/TagDefinition.java (modified) (4 diffs)
- trunk/src/net/schst/XJConf/XmlReader.java (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/src/net/schst/XJConf/AttributeDefinition.java
r10 r13 125 125 * @throws ValueConversionException 126 126 */ 127 public Object convertValue(Object val ) throws ValueConversionException {127 public Object convertValue(Object val, ClassLoader loader) throws ValueConversionException { 128 128 String value = (String)val; 129 129 Object instance = null; 130 130 try { 131 Class cl = Class.forName(this.type );131 Class cl = Class.forName(this.type, true,loader); 132 132 Class paramTypes[] = {value.getClass()}; 133 133 trunk/src/net/schst/XJConf/Definition.java
r1 r13 9 9 public String getName(); 10 10 public String getType(); 11 public Object convertValue(Object value ) throws ValueConversionException;11 public Object convertValue(Object value, ClassLoader loader) throws ValueConversionException; 12 12 public String getSetterMethod(); 13 13 } trunk/src/net/schst/XJConf/Tag.java
r7 r13 141 141 * @return converted value 142 142 */ 143 public Object getConvertedValue( ) throws ValueConversionException {144 return this.def.convertValue(this );143 public Object getConvertedValue(ClassLoader loader) throws ValueConversionException { 144 return this.def.convertValue(this,loader); 145 145 } 146 146 trunk/src/net/schst/XJConf/TagDefinition.java
r12 r13 142 142 * @throws ValueConversionException 143 143 */ 144 public Object convertValue(Object v ) throws ValueConversionException {144 public Object convertValue(Object v, ClassLoader loader) throws ValueConversionException { 145 145 Tag tag = (Tag)v; 146 146 … … 157 157 try { 158 158 // get the class object 159 cl = Class.forName(this.type );159 cl = Class.forName(this.type,true,loader); 160 160 } catch (Exception e) { 161 161 throw new ValueConversionException("Class " + this.type + " does not exist", e); … … 199 199 attVal = att.getDefault(); 200 200 } 201 Object val = att.convertValue(attVal );201 Object val = att.convertValue(attVal,loader); 202 202 203 203 try { … … 225 225 226 226 methodName = child.getDefinition().getSetterMethod(); 227 Object childValue = child.getDefinition().convertValue(child );227 Object childValue = child.getDefinition().convertValue(child,loader); 228 228 Object childParams[] = {childValue}; 229 229 trunk/src/net/schst/XJConf/XmlReader.java
r12 r13 68 68 */ 69 69 private SAXParserFactory parserFactory = null; 70 71 72 private ClassLoader loader = this.getClass().getClassLoader(); 73 74 public XmlReader() { 75 super(); 76 } 77 78 public XmlReader(ClassLoader loader) { 79 super(); 80 this.loader = loader; 81 } 82 70 83 71 84 /** … … 242 255 243 256 if (this.depth == 1) { 244 this.config.put(tag.getKey(), tag.getConvertedValue( ));257 this.config.put(tag.getKey(), tag.getConvertedValue(this.loader)); 245 258 } else { 246 259 Tag parent = (Tag)this.tagStack.pop();
