info.tomfi.hebcal.shabbat.response.AutoValue_Response Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of hebcal-api Show documentation
Show all versions of hebcal-api Show documentation
A Java API encapsulating HebCal's REST API.
package info.tomfi.hebcal.shabbat.response;
import info.tomfi.hebcal.shabbat.internal.Nullable;
import java.util.List;
import java.util.Optional;
// Generated by com.google.auto.value.processor.AutoValueProcessor
final class AutoValue_Response extends Response {
private final String date;
private final Optional> items;
private final Optional link;
private final ResponseLocation location;
private final String title;
private AutoValue_Response(
String date,
Optional> items,
Optional link,
ResponseLocation location,
String title) {
this.date = date;
this.items = items;
this.link = link;
this.location = location;
this.title = title;
}
@Override
public String date() {
return date;
}
@Override
public Optional> items() {
return items;
}
@Override
public Optional link() {
return link;
}
@Override
public ResponseLocation location() {
return location;
}
@Override
public String title() {
return title;
}
@Override
public String toString() {
return "Response{"
+ "date=" + date + ", "
+ "items=" + items + ", "
+ "link=" + link + ", "
+ "location=" + location + ", "
+ "title=" + title
+ "}";
}
@Override
public boolean equals(Object o) {
if (o == this) {
return true;
}
if (o instanceof Response) {
Response that = (Response) o;
return this.date.equals(that.date())
&& this.items.equals(that.items())
&& this.link.equals(that.link())
&& this.location.equals(that.location())
&& this.title.equals(that.title());
}
return false;
}
@Override
public int hashCode() {
int h$ = 1;
h$ *= 1000003;
h$ ^= date.hashCode();
h$ *= 1000003;
h$ ^= items.hashCode();
h$ *= 1000003;
h$ ^= link.hashCode();
h$ *= 1000003;
h$ ^= location.hashCode();
h$ *= 1000003;
h$ ^= title.hashCode();
return h$;
}
static final class Builder extends Response.Builder {
private String date;
private Optional> items = Optional.empty();
private Optional link = Optional.empty();
private ResponseLocation location;
private String title;
Builder() {
}
@Override
public Response.Builder date(String date) {
if (date == null) {
throw new NullPointerException("Null date");
}
this.date = date;
return this;
}
@Override
public Response.Builder items(@Nullable List items) {
this.items = Optional.ofNullable(items);
return this;
}
@Override
public Response.Builder link(@Nullable String link) {
this.link = Optional.ofNullable(link);
return this;
}
@Override
public Response.Builder location(ResponseLocation location) {
if (location == null) {
throw new NullPointerException("Null location");
}
this.location = location;
return this;
}
@Override
public Response.Builder title(String title) {
if (title == null) {
throw new NullPointerException("Null title");
}
this.title = title;
return this;
}
@Override
public Response build() {
if (this.date == null
|| this.location == null
|| this.title == null) {
StringBuilder missing = new StringBuilder();
if (this.date == null) {
missing.append(" date");
}
if (this.location == null) {
missing.append(" location");
}
if (this.title == null) {
missing.append(" title");
}
throw new IllegalStateException("Missing required properties:" + missing);
}
return new AutoValue_Response(
this.date,
this.items,
this.link,
this.location,
this.title);
}
}
}