Changeset 13

Show
Ignore:
Timestamp:
07/20/05 18:03:16 (3 years ago)
Author:
niels
Message:

added classloader attribute, for generated classes

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/src/net/schst/XJConf/AttributeDefinition.java

    r10 r13  
    125125     * @throws ValueConversionException 
    126126     */ 
    127     public Object convertValue(Object val) throws ValueConversionException { 
     127    public Object convertValue(Object val, ClassLoader loader) throws ValueConversionException { 
    128128        String value = (String)val; 
    129129        Object instance = null; 
    130130        try { 
    131             Class cl = Class.forName(this.type); 
     131            Class cl = Class.forName(this.type, true,loader); 
    132132            Class paramTypes[] = {value.getClass()}; 
    133133             
  • trunk/src/net/schst/XJConf/Definition.java

    r1 r13  
    99    public String getName(); 
    1010    public String getType(); 
    11     public Object convertValue(Object value) throws ValueConversionException; 
     11    public Object convertValue(Object value, ClassLoader loader) throws ValueConversionException; 
    1212    public String getSetterMethod(); 
    1313} 
  • trunk/src/net/schst/XJConf/Tag.java

    r7 r13  
    141141     * @return  converted value 
    142142     */ 
    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); 
    145145    } 
    146146 
  • trunk/src/net/schst/XJConf/TagDefinition.java

    r12 r13  
    142142     * @throws ValueConversionException 
    143143     */ 
    144     public Object convertValue(Object v) throws ValueConversionException { 
     144    public Object convertValue(Object v, ClassLoader loader) throws ValueConversionException { 
    145145        Tag tag = (Tag)v; 
    146146         
     
    157157        try { 
    158158            // get the class object 
    159             cl = Class.forName(this.type); 
     159            cl = Class.forName(this.type,true,loader); 
    160160        } catch (Exception e) { 
    161161            throw new ValueConversionException("Class " + this.type + " does not exist", e); 
     
    199199                attVal = att.getDefault(); 
    200200            } 
    201             Object val = att.convertValue(attVal); 
     201            Object val = att.convertValue(attVal,loader); 
    202202             
    203203            try { 
     
    225225 
    226226            methodName = child.getDefinition().getSetterMethod(); 
    227             Object childValue = child.getDefinition().convertValue(child); 
     227            Object childValue = child.getDefinition().convertValue(child,loader); 
    228228            Object childParams[] = {childValue}; 
    229229             
  • trunk/src/net/schst/XJConf/XmlReader.java

    r12 r13  
    6868     */ 
    6969    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     
    7083     
    7184   /** 
     
    242255 
    243256            if (this.depth == 1) { 
    244                 this.config.put(tag.getKey(), tag.getConvertedValue()); 
     257                this.config.put(tag.getKey(), tag.getConvertedValue(this.loader)); 
    245258            } else { 
    246259                Tag parent = (Tag)this.tagStack.pop();