diff options
Diffstat (limited to 'usage_examples')
-rw-r--r-- | usage_examples/DataExample_post.jpage | 8 | ||||
-rw-r--r-- | usage_examples/EqualsAndHashCodeExample_post.jpage | 4 |
2 files changed, 10 insertions, 2 deletions
diff --git a/usage_examples/DataExample_post.jpage b/usage_examples/DataExample_post.jpage index 29e7e328..e53e999c 100644 --- a/usage_examples/DataExample_post.jpage +++ b/usage_examples/DataExample_post.jpage @@ -42,6 +42,10 @@ public class DataExample { return "DataExample(" + this.getName() + ", " + this.getAge() + ", " + this.getScore() + ", " + Arrays.deepToString(this.getTags()) + ")"; } + protected boolean canEqual(Object other) { + return other instanceof DataExample; + } + @Override public boolean equals(Object o) { if (o == this) return true; if (!(o instanceof DataExample)) return false; @@ -90,6 +94,10 @@ public class DataExample { return "Exercise(name=" + this.getName() + ", value=" + this.getValue() + ")"; } + protected boolean canEqual(Object other) { + return other instanceof Exercise; + } + @Override public boolean equals(Object o) { if (o == this) return true; if (!(o instanceof Exercise)) return false; diff --git a/usage_examples/EqualsAndHashCodeExample_post.jpage b/usage_examples/EqualsAndHashCodeExample_post.jpage index aa6a44ba..f58e045b 100644 --- a/usage_examples/EqualsAndHashCodeExample_post.jpage +++ b/usage_examples/EqualsAndHashCodeExample_post.jpage @@ -33,7 +33,7 @@ public class EqualsAndHashCodeExample { return result; } - public boolean canEqual(Object other) { + protected boolean canEqual(Object other) { return other instanceof EqualsAndHashCodeExample; } @@ -65,7 +65,7 @@ public class EqualsAndHashCodeExample { return result; } - public boolean canEqual(Object other) { + protected boolean canEqual(Object other) { return other instanceof Square; } } |