DATACMNS-1726 - Delombok source files.
This commit is contained in:
@@ -15,10 +15,9 @@
|
||||
*/
|
||||
package org.springframework.data.geo;
|
||||
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import org.springframework.data.annotation.PersistenceConstructor;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
|
||||
/**
|
||||
* Represents a geospatial circle value
|
||||
@@ -28,7 +27,6 @@ import org.springframework.util.Assert;
|
||||
* @author Thomas Darimont
|
||||
* @since 1.8
|
||||
*/
|
||||
@EqualsAndHashCode
|
||||
public class Circle implements Shape {
|
||||
|
||||
private static final long serialVersionUID = 5215611530535947924L;
|
||||
@@ -93,6 +91,41 @@ public class Circle implements Shape {
|
||||
return radius;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see java.lang.Object#equals(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!(o instanceof Circle)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Circle circle = (Circle) o;
|
||||
|
||||
if (!ObjectUtils.nullSafeEquals(center, circle.center)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return ObjectUtils.nullSafeEquals(radius, circle.radius);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see java.lang.Object#hashCode()
|
||||
*/
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int result = ObjectUtils.nullSafeHashCode(center);
|
||||
result = 31 * result + ObjectUtils.nullSafeHashCode(radius);
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see java.lang.Object#toString()
|
||||
|
||||
@@ -15,14 +15,13 @@
|
||||
*/
|
||||
package org.springframework.data.geo;
|
||||
|
||||
import lombok.Value;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.springframework.data.domain.Range;
|
||||
import org.springframework.data.domain.Range.Bound;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
|
||||
/**
|
||||
* Value object to represent distances in a given metric.
|
||||
@@ -31,8 +30,7 @@ import org.springframework.util.Assert;
|
||||
* @author Thomas Darimont
|
||||
* @since 1.8
|
||||
*/
|
||||
@Value
|
||||
public class Distance implements Serializable, Comparable<Distance> {
|
||||
public final class Distance implements Serializable, Comparable<Distance> {
|
||||
|
||||
private static final long serialVersionUID = 2460886201934027744L;
|
||||
|
||||
@@ -192,4 +190,49 @@ public class Distance implements Serializable, Comparable<Distance> {
|
||||
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
public double getValue() {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
public Metric getMetric() {
|
||||
return this.metric;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see java.lang.Object#equals(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!(o instanceof Distance)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Distance distance = (Distance) o;
|
||||
|
||||
if (value != distance.value) {
|
||||
return false;
|
||||
}
|
||||
return ObjectUtils.nullSafeEquals(metric, distance.metric);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see java.lang.Object#hashCode()
|
||||
*/
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int result;
|
||||
long temp;
|
||||
temp = Double.doubleToLongBits(value);
|
||||
result = (int) (temp ^ (temp >>> 32));
|
||||
result = 31 * result + ObjectUtils.nullSafeHashCode(metric);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,8 +15,6 @@
|
||||
*/
|
||||
package org.springframework.data.geo;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageImpl;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
@@ -38,7 +36,7 @@ public class GeoPage<T> extends PageImpl<GeoResult<T>> {
|
||||
/**
|
||||
* The average distance of the underlying results.
|
||||
*/
|
||||
private final @Getter Distance averageDistance;
|
||||
private final Distance averageDistance;
|
||||
|
||||
/**
|
||||
* Creates a new {@link GeoPage} from the given {@link GeoResults}.
|
||||
@@ -94,4 +92,8 @@ public class GeoPage<T> extends PageImpl<GeoResult<T>> {
|
||||
public int hashCode() {
|
||||
return super.hashCode() + ObjectUtils.nullSafeHashCode(this.averageDistance);
|
||||
}
|
||||
|
||||
public Distance getAverageDistance() {
|
||||
return this.averageDistance;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,11 +15,11 @@
|
||||
*/
|
||||
package org.springframework.data.geo;
|
||||
|
||||
import lombok.NonNull;
|
||||
import lombok.Value;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
|
||||
/**
|
||||
* Value object capturing some arbitrary object plus a distance.
|
||||
*
|
||||
@@ -27,13 +27,64 @@ import java.io.Serializable;
|
||||
* @author Thomas Darimont
|
||||
* @since 1.8
|
||||
*/
|
||||
@Value
|
||||
public class GeoResult<T> implements Serializable {
|
||||
public final class GeoResult<T> implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1637452570977581370L;
|
||||
|
||||
@NonNull T content;
|
||||
@NonNull Distance distance;
|
||||
private final T content;
|
||||
private final Distance distance;
|
||||
|
||||
public GeoResult(T content, Distance distance) {
|
||||
|
||||
Assert.notNull(content, "Content must not be null");
|
||||
Assert.notNull(distance, "Distance must not be null");
|
||||
|
||||
this.content = content;
|
||||
this.distance = distance;
|
||||
}
|
||||
|
||||
public T getContent() {
|
||||
return this.content;
|
||||
}
|
||||
|
||||
public Distance getDistance() {
|
||||
return this.distance;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see java.lang.Object#equals(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!(o instanceof GeoResult)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
GeoResult<?> geoResult = (GeoResult<?>) o;
|
||||
|
||||
if (!ObjectUtils.nullSafeEquals(content, geoResult.content)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return ObjectUtils.nullSafeEquals(distance, geoResult.distance);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see java.lang.Object#hashCode()
|
||||
*/
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int result = ObjectUtils.nullSafeHashCode(content);
|
||||
result = 31 * result + ObjectUtils.nullSafeHashCode(distance);
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
*/
|
||||
package org.springframework.data.geo;
|
||||
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Collections;
|
||||
@@ -24,6 +23,7 @@ import java.util.List;
|
||||
|
||||
import org.springframework.data.annotation.PersistenceConstructor;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
@@ -33,7 +33,6 @@ import org.springframework.util.StringUtils;
|
||||
* @author Thomas Darimont
|
||||
* @since 1.8
|
||||
*/
|
||||
@EqualsAndHashCode
|
||||
public class GeoResults<T> implements Iterable<GeoResult<T>>, Serializable {
|
||||
|
||||
private static final long serialVersionUID = 8347363491300219485L;
|
||||
@@ -105,6 +104,41 @@ public class GeoResults<T> implements Iterable<GeoResult<T>>, Serializable {
|
||||
return (Iterator<GeoResult<T>>) results.iterator();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see java.lang.Object#equals(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!(o instanceof GeoResults)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
GeoResults<?> that = (GeoResults<?>) o;
|
||||
|
||||
if (!ObjectUtils.nullSafeEquals(results, that.results)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return ObjectUtils.nullSafeEquals(averageDistance, that.averageDistance);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see java.lang.Object#hashCode()
|
||||
*/
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int result = ObjectUtils.nullSafeHashCode(results);
|
||||
result = 31 * result + ObjectUtils.nullSafeHashCode(averageDistance);
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see java.lang.Object#toString()
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
*/
|
||||
package org.springframework.data.geo;
|
||||
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
@@ -25,6 +24,7 @@ import java.util.List;
|
||||
|
||||
import org.springframework.data.annotation.PersistenceConstructor;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
@@ -34,7 +34,6 @@ import org.springframework.util.StringUtils;
|
||||
* @author Thomas Darimont
|
||||
* @since 1.8
|
||||
*/
|
||||
@EqualsAndHashCode
|
||||
public class Polygon implements Iterable<Point>, Shape {
|
||||
|
||||
private static final long serialVersionUID = -2705040068154648988L;
|
||||
@@ -101,6 +100,34 @@ public class Polygon implements Iterable<Point>, Shape {
|
||||
return this.points.iterator();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see java.lang.Object#equals(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!(o instanceof Polygon)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Polygon that = (Polygon) o;
|
||||
return ObjectUtils.nullSafeEquals(points, that.points);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see java.lang.Object#hashCode()
|
||||
*/
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return ObjectUtils.nullSafeHashCode(points);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see java.lang.Object#toString()
|
||||
|
||||
Reference in New Issue
Block a user