-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Encode/decode fields in super classes
- Loading branch information
Showing
4 changed files
with
84 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package com.fauna.beans; | ||
|
||
import java.util.Objects; | ||
|
||
public class ClassWithInheritance extends ClassWithAttributes { | ||
|
||
|
||
public ClassWithInheritance(String firstName, String lastName, int age) { | ||
super(firstName, lastName, age); | ||
} | ||
|
||
public ClassWithInheritance() { | ||
} | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (this == o) return true; | ||
|
||
if (o == null) return false; | ||
|
||
if (getClass() != o.getClass()) return false; | ||
|
||
ClassWithInheritance c = (ClassWithInheritance) o; | ||
|
||
return Objects.equals(getFirstName(), c.getFirstName()) | ||
&& Objects.equals(getLastName(), c.getLastName()) | ||
&& Objects.equals(getAge(), c.getAge()); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hash(getFirstName(), getLastName(), getAge()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package com.fauna.beans; | ||
|
||
import java.util.Objects; | ||
|
||
public class ClassWithInheritanceL2 extends ClassWithInheritance { | ||
|
||
|
||
public ClassWithInheritanceL2(String firstName, String lastName, int age) { | ||
super(firstName, lastName, age); | ||
} | ||
|
||
public ClassWithInheritanceL2() { | ||
} | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (this == o) return true; | ||
|
||
if (o == null) return false; | ||
|
||
if (getClass() != o.getClass()) return false; | ||
|
||
ClassWithInheritanceL2 c = (ClassWithInheritanceL2) o; | ||
|
||
return Objects.equals(getFirstName(), c.getFirstName()) | ||
&& Objects.equals(getLastName(), c.getLastName()) | ||
&& Objects.equals(getAge(), c.getAge()); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hash(getFirstName(), getLastName(), getAge()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters