Jeff, can you please create a new Jira issue and attach all relevant files. I'd like to have a look at this in detail, and I'd rather have access to your environment.
Regards Werner Jeff Crump wrote: > Yes, I've tried that, but it doesn't work: The unmarshaller complains that > there isn't a get/set for it on the IPMISensors class. Moving the field > definition into the IPMIPowerSupplySensor class doesn't work right either; I > don't want to set the attribute on every instance, just on the container. > > In short, I'd like to create a subclass of ArrayList (or some other > collection type) on which I can set that property, without having to resort > to creating an artificial container-of-container class. Think of it as a > decorator, I guess. > > Jeff > > 2008/12/5 Ralf Joachim <[EMAIL PROTECTED]> > >> Hi Jeff, >> >> have you already tried something like: >> >> <class name="mypackage.sensors.IPMISensors" auto-complete="false" >> verify-constructable="false"> >> <field name="redund" type="boolean"> >> <bind-xml name="redund" location="psSensors" node="attribute" >> /> >> </field> >> <field name="powerSupplySensors" >> type="mypackage.sensors.IPMIPowerSupplySensor" >> required="false" direct="false" transient="false" >> container="false" collection="collection"> >> <bind-xml name="psSensors" node="element" /> >> </field> >> </class> >> >> Regards >> Ralf >> >> >> Jeff Crump schrieb: >> >> Hi Werner, >> >> I would prefer to not use the intermediate class approach. Can you point >> me to documentation on the property approach? Thanks. >> >> Jeff >> >> 2008/12/5 Werner Guttmann <[EMAIL PROTECTED]> >> >>> Hi Jeff, >>> >>> Jeff Crump wrote: >>>> I'm having trouble unmarshalling a list of elements into a collection >>> that >>>> itself has an attribute: >>>> >>>> <ipmiSensors> >>>> <psSensors redund="True"> >>>> <powerSupply status="ok" present="True" name="Power Supply1"/> >>>> <powerSupply status="ok" present="True" name="Power Supply2"/> >>>> </psSensors> >>>> </ipmiSensors> >>>> >>>> If I ignore the 'redund' attribute, I can unmarshall this into a >>>> Collection<T> instance easily: >>>> >>>> <class name="mypackage.sensors.IPMISensors" auto-complete="false" >>>> verify-constructable="false"> >>>> <field name="powerSupplySensors" >>>> type="mypackage.sensors.IPMIPowerSupplySensor" >>>> required="false" direct="false" transient="false" >>>> container="false" collection="collection"> >>>> <bind-xml name="psSensors" node="element" /> >>>> </field> >>>> </class> >>>> >>>> This does exactly what I would expect, and add the <powerSupply> >>> instances >>>> to the Collection. >>>> >>>> But that attribute on the <psSensors> element is puzzling me. >>> Obviously I >>>> can't unmarshall this into a Collection<T> anymore - I have to create my >>> own >>>> subclass of, say, ArrayList<T>, right? Except nothing I try seems to >>> work. >>>> Am I on the right track? >>> No, not really. Let me ask you a question and suggest one possible >>> solution. >>> >>> Question: where (in your object model) would you like to store the value >>> of the 'redund' attribute. >>> >>> Possible solution: >>> >>> a) Store the attribute value in a property on the class >>> mypackage.sensors.IPMISensors, and use a location in the XML binding for >>> this attribute. >>> b) Create an intermediate class for <psSensors> that has two members, >>> one for the collection of PowerSupply#s and one for the attribute value. >>> >>>> I really don't want to create a collection within >>>> a collection -- I don't want to make this one class different than all >>> of >>>> the others in the set I'm working with. >>>> >>>> Any advice? >>>> >>>> Jeff >>>> >>> --------------------------------------------------------------------- >>> To unsubscribe from this list, please visit: >>> >>> http://xircles.codehaus.org/manage_email >>> >>> >>> >> -- >> >> Syscon Ingenieurbüro für Meß- und Datentechnik GmbH >> Ralf Joachim >> Raiffeisenstraße 11 >> 72127 Kusterdingen >> Germany >> >> Tel. +49 7071 3690 52 >> Mobil: +49 173 9630135 >> Fax +49 7071 3690 98 >> >> Internet: www.syscon.eu >> E-Mail: [EMAIL PROTECTED] >> >> Sitz der Gesellschaft: D-72127 Kusterdingen >> Registereintrag: Amtsgericht Stuttgart, HRB 382295 >> Geschäftsleitung: Jens Joachim, Ralf Joachim >> >> > --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email

