io.polyglotted.pgmodel.geo.GeoShape Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pg-model Show documentation
Show all versions of pg-model Show documentation
Standard set of models for geo coding, access control and elastic search abstraction
The newest version!
package io.polyglotted.pgmodel.geo;
import lombok.AccessLevel;
import lombok.RequiredArgsConstructor;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;
import java.util.Objects;
import static com.google.common.base.Preconditions.checkNotNull;
import static io.polyglotted.pgmodel.util.ModelUtil.jsonEquals;
@ToString(includeFieldNames = false)
@RequiredArgsConstructor
public final class GeoShape {
public final GeoType type;
public final String coordinates;
public final String radius;
@Override
public boolean equals(Object o) {
return jsonEquals(this, o);
}
@Override
public int hashCode() {
return Objects.hash(type, coordinates, radius);
}
public static Builder shapeBuilder() {
return new Builder();
}
@Setter
@Accessors(fluent = true, chain = true)
@RequiredArgsConstructor(access = AccessLevel.PRIVATE)
public static class Builder {
private GeoType type;
private String coordinates;
private String radius;
public GeoShape build() {
return new GeoShape(checkNotNull(type, "type is required"), checkNotNull(coordinates,
"coordinates is required"), radius);
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy