Hi Dean, The _has_lampMode is how Castor determines if the field actually exists or not. If _has_lampMode is set to false then Castor will throw a validation exception if you try to marshal your object model because lampMode is a required field.
Without this _has_xxxx field Castor would have no way of knowing whether the field actually exists (with a user-supplied value) or not because all primitives in Java have default values. --Keith Dean Hiller wrote: > > Ok, I think I understand, but I think there may still be a small bug. > Maybe we want the line changed from > > if((!type.isEnumerated()) && jType.isPrimitive()) > to > if((!type.isEnumerated()) && jType.isPrimitive() && !isRequired()) > > The reason I ask is in the attached schema, there is a required field > lampMode. It is required and must always exist, yet the source code > generated a _has_lampMode field like it is optional when it isn't. Can > you take a look at this real quick. > thanks, > Dean > > Arnaud Blandin wrote: > > > Hi Dean, > > > > The 'has' method is generated mainly for the Marshalling Framework to > > identify whether or not a primitive value has been used so I guess the > > code already in place is correct. > > > > Arnaud > > > -----Original Message----- > > > From: Dean Hiller [mailto:[EMAIL PROTECTED]] > > > Sent: Thursday, December 26, 2002 9:57 PM > > > To: [EMAIL PROTECTED] > > > Subject: [castor-dev] fix for optional types > > > > > > Can someone change line 174 of FieldInfo.java which says > > > if((!type.isEnumerated()) && jType.isPrimitive()) > > > > > > to > > > if(!isRequired()) > > > > > > I don't understand why in the world isEnum and isPrimitive is there. > > I > > > already owe one test case and will write one for this also. Company > > > network back up, so I will write both tomorrow. > > > thanks, > > > Dean > > > > > > ----------------------------------------------------------- > > > If you wish to unsubscribe from this mailing, send mail to > > > [EMAIL PROTECTED] with a subject of: > > > unsubscribe castor-dev > > > > ----------------------------------------------------------- > > If you wish to unsubscribe from this mailing, send mail to > > [EMAIL PROTECTED] with a subject of: > > unsubscribe castor-dev > > ------------------------------------------------------------------------ > <?xml version="1.0" encoding="UTF-8"?> > <xsd:schema targetNamespace="http://www.ecma.ch/standards/ecma-323/csta" >xmlns:xsd="http://www.w3.org/2001/XMLSchema" >xmlns:csta="http://www.ecma.ch/standards/ecma-323/csta" >elementFormDefault="qualified" attributeFormDefault="unqualified"> > <xsd:annotation> > <xsd:documentation>CSTA-lamp-mode-event</xsd:documentation> > </xsd:annotation> > <xsd:include schemaLocation="device-identifiers.xsd"/> > <xsd:include schemaLocation="extension-types.xsd"/> > <xsd:include schemaLocation="physical-device-features.xsd"/> > <xsd:include schemaLocation="status-reporting.xsd"/> > <xsd:element name="LampModeEvent"> > <xsd:complexType> > <xsd:sequence> > <xsd:element ref="csta:monitorCrossRefID"/> > <xsd:element name="device" type="csta:SubjectDeviceID"/> > <xsd:element name="lamp" type="csta:LampID"/> > <xsd:element name="lampLabel" minOccurs="0"> > <xsd:simpleType> > <xsd:restriction base="xsd:string"> > <xsd:minLength value="0"/> > <xsd:maxLength value="64"/> > </xsd:restriction> > </xsd:simpleType> > </xsd:element> > <xsd:element name="lampMode" type="csta:LampMode"/> > <xsd:element name="lampBrightness" type="csta:LampBrightness" minOccurs="0"/> > <xsd:element name="lampColor" type="csta:LampColor" minOccurs="0"/> > <xsd:element ref="csta:extensions" minOccurs="0"/> > </xsd:sequence> > </xsd:complexType> > </xsd:element> > </xsd:schema> ----------------------------------------------------------- If you wish to unsubscribe from this mailing, send mail to [EMAIL PROTECTED] with a subject of: unsubscribe castor-dev
