package au.id.zancanaro.javacheck.object; public class MyObject { public final String string; public final int value; public final SubObject subObject; public MyObject(String string, int value, SubObject subObject) { this.string = string; this.value = value; this.subObject = subObject; } @UseForGeneration public MyObject(String string, SubObject subObject) { this(string, string.length(), subObject); } public MyObject add(MyObject other) { return new MyObject( this.string + other.string, this.value + other.value, this.subObject.add(other.subObject)); } @Override public String toString() { return "{" + string + ", " + value + ", " + subObject + "}"; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; MyObject myObject = (MyObject) o; return value == myObject.value && string.equals(myObject.string) && subObject.equals(myObject.subObject); } @Override public int hashCode() { int result = string.hashCode(); result = 31 * result + value; result = 31 * result + subObject.hashCode(); return result; } }