com.ohmdb.test.Book Maven / Gradle / Ivy
package com.ohmdb.test;
/*
* #%L
* ohmdb-test
* %%
* Copyright (C) 2013 - 2014 Nikolche Mihajlovski
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
public class Book {
public long id;
public String title;
public boolean published;
public int year = 1984;
public Book(String title, boolean published) {
this.title = title;
this.published = published;
}
public Book() {
}
@Override
public String toString() {
return "Book [id=" + id + ", title=" + title + ", published=" + published + ", year=" + year + "]";
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + (published ? 1231 : 1237);
result = prime * result + ((title == null) ? 0 : title.hashCode());
result = prime * result + year;
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Book other = (Book) obj;
if (published != other.published)
return false;
if (title == null) {
if (other.title != null)
return false;
} else if (!title.equals(other.title))
return false;
if (year != other.year)
return false;
return true;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy