Hi Christopher,
you may have a look at: http://jira.codehaus.org/browse/CASTOR
if this is a known issue on castor. If its known there may be a patch
attached that solves the problem. If its not known it would help if you
could create one and attach a test case that reproduces the problem.
Ralf
MATHRUSSE, CHRISTOPHER (SBCSI) schrieb:
I did try this as a solution but even when the field in the generated
class file was defined as a java.lang.Integer data type the constructor
of the class did not call the setAgrmtMoCt(0) method. I had hoped that
this would have solved the problem but did not. I verified that I can
resolve the problem by specifying the data type for this element in the
schema as an xs:decimal, then the field in java gets defined as a
BigDecimal and the initialization is correctly performed, so whatever
the problem is it appears to be associated with the xs:integer data
type.
-----Original Message-----
From: Jean Witte [mailto:[EMAIL PROTECTED]
Sent: Wednesday, July 27, 2005 8:28 AM
To: [email protected]
Subject: Re: [castor-user] Xs:integer default value not being set
Christopher,
Try to use object wrappers instead of primitive when you generate your
classes.
In the castorbuiler.properties file set
"org.exolab.castor.builder.primitivetowrapper" to true.
org.exolab.castor.builder.primitivetowrapper=true
JW.
--- "MATHRUSSE, CHRISTOPHER (SBCSI)" <[EMAIL PROTECTED]> wrote:
I have defined my element as follows:
<xs:element name="agrmtMoCt" default="0">
<xs:simpleType>
<xs:restriction base="xs:integer">
<xs:minInclusive value="0"/>
<xs:maxInclusive value="99"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
As you can see I have specified a default value of '0'.
The generated class has defined as follows:
/**
* Defines the package's Term length in months.
*/
private int _agrmtMoCt = 0;
/**
* keeps track of state for field: _agrmtMoCt
*/
private boolean _has_agrmtMoCt;
The problem I am faced with is in the constructor of the generated
class
the setAgrmtMoCt(0) is not being called. While the default value is
assigned at declaration, the _has_agrmtMoCt is not being initialized
so
the result is an initial value of false. Unless I explicitly call in
my
code setAgrmtMoCt(0), the validate method will throw an exception
complaining about a missing value. The behavior in the generated code
is
correct for xs:string and xs:decimal data types, but for some reason
not
for xs:integer.
-------------------------------------------------
If you wish to unsubscribe from this list, please
send an empty message to the following address:
[EMAIL PROTECTED]
-------------------------------------------------
____________________________________________________
Start your day with Yahoo! - make it your home page
http://www.yahoo.com/r/hs
-------------------------------------------------
If you wish to unsubscribe from this list, please
send an empty message to the following address:
[EMAIL PROTECTED]
-------------------------------------------------
-------------------------------------------------
If you wish to unsubscribe from this list, please
send an empty message to the following address:
[EMAIL PROTECTED]
-------------------------------------------------
--
Syscon Ingenieurbüro für
Meß- und Datentechnik GmbH
Ralf Joachim
Raiffeisenstraße 11
D-72127 Kusterdingen
Germany
Tel. +49 7071 3690 52
Mobil: +49 173 9630135
Fax +49 7071 3690 98
Email: [EMAIL PROTECTED]
Web: www.syscon-world.de
-------------------------------------------------
If you wish to unsubscribe from this list, please
send an empty message to the following address:
[EMAIL PROTECTED]
-------------------------------------------------