Skip to content

Instantly share code, notes, and snippets.

@dajulia3
Created June 12, 2016 22:20
Show Gist options
  • Save dajulia3/7838b682b6c36a196a6e897b7363376f to your computer and use it in GitHub Desktop.
Save dajulia3/7838b682b6c36a196a6e897b7363376f to your computer and use it in GitHub Desktop.
package com.djulia.session.domain;
import java.util.Objects;
public class Restaurant {
private final String name;
private final String ownerName;
private final String headChefName;
private final String cusineType;
private final String shortDescription;
private final String fullDescription;
private final String websiteUrl;
private final int rating;
private final int michelinStarRating;
private final int zagatRating;
public Restaurant(String name, String ownerName, String headChefName, String cusineType, String shortDescription, String fullDescription, String websiteUrl, int rating, int michelinStarRating, int zagatRating) {
this.name = Objects.requireNonNull(name);
this.ownerName = Objects.requireNonNull(ownerName);
this.headChefName = Objects.requireNonNull(headChefName);
this.cusineType = Objects.requireNonNull(cusineType);
this.shortDescription = Objects.requireNonNull(shortDescription);
this.fullDescription = Objects.requireNonNull(fullDescription);
this.websiteUrl = Objects.requireNonNull(websiteUrl);
this.rating = Objects.requireNonNull(rating);
this.michelinStarRating = Objects.requireNonNull(michelinStarRating);
this.zagatRating = Objects.requireNonNull(zagatRating);
}
public String getName() {
return name;
}
public String getOwnerName() {
return ownerName;
}
public String getHeadChefName() {
return headChefName;
}
public String getCusineType() {
return cusineType;
}
public String getShortDescription() {
return shortDescription;
}
public String getFullDescription() {
return fullDescription;
}
public String getWebsiteUrl() {
return websiteUrl;
}
public int getRating() {
return rating;
}
public int getMichelinStarRating() {
return michelinStarRating;
}
public int getZagatRating() {
return zagatRating;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Restaurant that = (Restaurant) o;
if (rating != that.rating) return false;
if (michelinStarRating != that.michelinStarRating) return false;
if (zagatRating != that.zagatRating) return false;
if (name != null ? !name.equals(that.name) : that.name != null) return false;
if (ownerName != null ? !ownerName.equals(that.ownerName) : that.ownerName != null) return false;
if (headChefName != null ? !headChefName.equals(that.headChefName) : that.headChefName != null) return false;
if (cusineType != null ? !cusineType.equals(that.cusineType) : that.cusineType != null) return false;
if (shortDescription != null ? !shortDescription.equals(that.shortDescription) : that.shortDescription != null)
return false;
if (fullDescription != null ? !fullDescription.equals(that.fullDescription) : that.fullDescription != null)
return false;
return websiteUrl != null ? websiteUrl.equals(that.websiteUrl) : that.websiteUrl == null;
}
@Override
public int hashCode() {
int result = name != null ? name.hashCode() : 0;
result = 31 * result + (ownerName != null ? ownerName.hashCode() : 0);
result = 31 * result + (headChefName != null ? headChefName.hashCode() : 0);
result = 31 * result + (cusineType != null ? cusineType.hashCode() : 0);
result = 31 * result + (shortDescription != null ? shortDescription.hashCode() : 0);
result = 31 * result + (fullDescription != null ? fullDescription.hashCode() : 0);
result = 31 * result + (websiteUrl != null ? websiteUrl.hashCode() : 0);
result = 31 * result + rating;
result = 31 * result + michelinStarRating;
result = 31 * result + zagatRating;
return result;
}
@Override
public String toString() {
return "Restaurant{" +
"name='" + name + '\'' +
", ownerName='" + ownerName + '\'' +
", headChefName='" + headChefName + '\'' +
", cusineType='" + cusineType + '\'' +
", shortDescription='" + shortDescription + '\'' +
", fullDescription='" + fullDescription + '\'' +
", websiteUrl='" + websiteUrl + '\'' +
", rating=" + rating +
", michelinStarRating=" + michelinStarRating +
", zagatRating=" + zagatRating +
'}';
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment