Hi I am an absolute beginner wih castor, and I beg your pardon in andvance, if my question is trivial!


I have a problem with the source code generator, and I wonder, if it is a bug or a feature:
The getContent()-Methods of my generated sublasses overwrite the getContent() Method of my generated superClass, but why?


Let my explain, what I want to achieve - maybe even my method of solution is wrong:


My intention:
================
The content of my source-xml-Documents contains beanshell scripts. The content of the generated xml-document contains the result of the evaluated script:


xml input:
<param id="paramId" language="bsh" default="0">
   user().getId();
</param>

desired xml output:
<param id="paramId" >
   14
</param>


My method of solution:
================
In my schema I defined a complexType named 'scriptable' and derived the element 'param' by extension from 'scriptable'.
I hoped, that I just have to modify the class scriptable (calling there the appropriate script interpreter, evaluating the script, returning he result...), and all classes derived by scriptable do the same.


(My simplified schema see below.)



My Problem
================
In the generated source code of param.java all methods concerning the content of the element are overwritten!
(The methods concerning the atributes of scriptable (language, value) are not overwritten!!). I wonder why!


Please, can anybody hep me!
- Is this a bug or a feature?
- In any case: Do you know a workaround?

Thanks in advance!!!
Claudia


simplified schema: ---------------------------------- <xs:schema xmlns:forms="http://primefactory/forms"; xmlns:xs="http://www.w3.org/2001/XMLSchema"; elementFormDefault="qualified" attributeFormDefault="unqualified"> <xs:element name="param"> <xs:complexType> <xs:simpleContent> <xs:extension base="scriptable" /> </xs:simpleContent> </xs:complexType> </xs:element> <xs:complexType name="scriptable"> <xs:simpleContent> <xs:extension base="xs:string"> <xs:attribute name="language" /> <xs:attribute name="value" type="xs:string" /> </xs:extension> </xs:simpleContent> </xs:complexType> </xs:schema>

param.java:
----------------------------------
[...]

public class Param extends de.sample.Scriptable
implements java.io.Serializable

[...]

private java.lang.String _content = "";

   public java.lang.String getContent()
   {
       return this._content;
   } //-- java.lang.String getContent()

   public void setContent(java.lang.String content)
   {
       this._content = content;
   } //-- void setContent(java.lang.String)

[...]

}

scriptable.java:
----------------------------------
[...]

public abstract class Scriptable implements java.io.Serializable {

[...]

private java.lang.String _content = "";

   public java.lang.String getContent()
   {
       return this._content;
   } //-- java.lang.String getContent()

   public void setContent(java.lang.String content)
   {
       this._content = content;
   } //-- void setContent(java.lang.String)

[...]

}

----------------------------------------------------------- If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev




Reply via email to