users@jaxb.java.net

Comparing two jaxb-generated objects by value

From: Jean-Marie Condom <jmc_at_meteorage.com>
Date: Tue, 18 Jan 2005 12:13:58 +0100

Hi

i am using jaxb-verification.jar and hyperjaxb.jar

i have the following pb with method equals(java.lang.Object obj) :

considering that in my schema i have the following specification :

<!-- GeoColorTab -->
<xsd:complexType name="GeoColorTab">
  <xsd:sequence>
    <xsd:element name="GeoColor" type="GeoColor" minOccurs="1"
maxOccurs="unbounded"/>
  </xsd:sequence>
</xsd:complexType>
<!-- GeoColor -->
<xsd:complexType name="GeoColor">
  <xsd:attribute name="num" type="xsd:int" use="required"/>
  <xsd:attribute name="r" type="xsd:float" use="required"/>
  <xsd:attribute name="g" type="xsd:float" use="required"/>
  <xsd:attribute name="b" type="xsd:float" use="required"/>
</xsd:complexType>

the equals method generated in file GeoColorTabImpl.java looks as follows :

    public boolean equals(java.lang.Object obj) {
      System.out.println("geoColorTabImpl -equals");
        if (this == obj) {
            return true;
        }
        if ((null == obj)||(obj.getClass()!= this.getClass())) {
            return false;
        }
        meteorage.jobs.params.configuration.impl.GeoColorTabImpl target
= ((meteorage.jobs.params.configuration.impl.GeoColorTabImpl) obj);
        {
            java.util.List value = this.getGeoColor();
            java.util.List targetValue = target.getGeoColor();
            if (!((value == targetValue)||((value!=
null)&&value.equals(targetValue)))) {
                return false;
            }
        }
        return true;
    }

the condition " value.equals(targetValue)" in fact calls method "boolean
equals(Object o);"
in interface List and not method "public boolean equals(java.lang.Object
obj)" in file GeoColorImpl.java !

that's a pb for me as the comparison is not achieved deeply

thanks for your help

Jean-Marie





-- 
Jean-Marie Condom
Software development team
Sté Météorage
2 av Angot
64053 PAU
France 
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
For additional commands, e-mail: users-help_at_jaxb.dev.java.net