Closed GoogleCodeExporter closed 8 years ago
Based on group email:
Hi,
Thanks for the great work on the API.
I'm using the JAXB client, and I am admittedly new to using JAXB.
I used a free plugin in Intellij to: "Generate files from your XSD
schemas with JAXB 2.0 XJC generator"
Quite handy.
I was writing integration tests such as:
Create a new album on FB with certain properties set.
Get all albums for that user from FB
Assert that the list of all actual albums contains the expectedAlbum
that I just created.
I ran into a snag because equals and hashCode were not overriden in
the JAXB generated classes. (same w/ the ones in the lib JAR.)
So, I made a quick fix by dropping this into my generated
com.google.code.facebookapi.schema.Album class.
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
public boolean equals(final Object obj) {
return EqualsBuilder.reflectionEquals(this, obj);
}
public int hashCode() {
return HashCodeBuilder.reflectionHashCode(this);
}
---
I did a little research and found these projects for automatically
overriding equals(), hashCode() and toString() in JAXB generated
classes.
https://jaxb2-commons.dev.java.net/commons-lang-plugin/
https://hyperjaxb3.dev.java.net/docs/tools/plugin/index.html
Does this look like a worthwhile addition to the FB API release jar?
Thanks,
Ed
Original comment by david.j....@googlemail.com
on 15 Jan 2009 at 9:19
Original comment by david.j....@googlemail.com
on 15 Jan 2009 at 9:24
Original issue reported on code.google.com by
david.j....@googlemail.com
on 15 Jan 2009 at 9:18