File tree Expand file tree Collapse file tree 1 file changed +15
-2
lines changed
objectbox-java/src/main/java/io/objectbox/relation Expand file tree Collapse file tree 1 file changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -55,10 +55,10 @@ public class ToOne<TARGET> implements Serializable {
5555 * @param relationInfo Meta info as generated in the Entity_ (entity name plus underscore) classes.
5656 */
5757 public ToOne (Object sourceEntity , RelationInfo relationInfo ) {
58- if (sourceEntity == null ) {
58+ if (sourceEntity == null ) {
5959 throw new IllegalArgumentException ("No source entity given (null)" );
6060 }
61- if (relationInfo == null ) {
61+ if (relationInfo == null ) {
6262 throw new IllegalArgumentException ("No relation info given (null)" );
6363 }
6464 this .entity = sourceEntity ;
@@ -274,4 +274,17 @@ public void internalPutTarget(Cursor<TARGET> targetCursor) {
274274 Object getEntity () {
275275 return entity ;
276276 }
277+
278+ @ Override
279+ public boolean equals (Object obj ) {
280+ if (!(obj instanceof ToOne )) return false ;
281+ ToOne other = (ToOne ) obj ;
282+ return relationInfo == other .relationInfo && getTargetId () == other .getTargetId ();
283+ }
284+
285+ @ Override
286+ public int hashCode () {
287+ long targetId = getTargetId ();
288+ return (int ) (targetId ^ targetId >>> 32 );
289+ }
277290}
You can’t perform that action at this time.
0 commit comments