Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.itstep.mvn.app.model;
- public class Reader {
- private int id;
- private String name;
- public Reader(int id, String name) {
- super();
- this.id = id;
- this.name = name;
- }
- public int getId() {
- return id;
- }
- public void setId(int id) {
- this.id = id;
- }
- public String getName() {
- return name;
- }
- public void setName(String name) {
- this.name = name;
- }
- @Override
- public String toString() {
- return "Reader [id=" + id + ", name=" + name + "]";
- }
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + id;
- result = prime * result + ((name == null) ? 0 : name.hashCode());
- System.out.println("Reader -> hashCode() : " + result);
- return result;
- }
- @Override
- public boolean equals(Object obj) {
- System.out.println("Reader -> equals()");
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- Reader other = (Reader) obj;
- if (id != other.id)
- return false;
- if (name == null) {
- if (other.name != null)
- return false;
- } else if (!name.equals(other.name))
- return false;
- System.out.println(" TRUE");
- return true;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement