Fix checkstyle errors

This commit is contained in:
Karel Maesen 2021-09-18 17:37:54 +02:00
parent 5bae2d8196
commit cf854c5cfc
8 changed files with 46 additions and 144 deletions

View File

@ -10,6 +10,7 @@ package org.hibernate.spatial;
* Enumeration of types of Spatial Aggregation * Enumeration of types of Spatial Aggregation
* *
* @author Karel Maesen * @author Karel Maesen
* @deprecated Will be removed in 6.0
*/ */
@Deprecated @Deprecated
public interface SpatialAggregate { public interface SpatialAggregate {

View File

@ -10,6 +10,7 @@ package org.hibernate.spatial;
* The spatial analysis functions defined in the OGC SFS specification. * The spatial analysis functions defined in the OGC SFS specification.
* *
* @author Karel Maesen * @author Karel Maesen
* @deprecated Will be removed in 6
*/ */
@Deprecated @Deprecated
public interface SpatialAnalysis { public interface SpatialAnalysis {

View File

@ -12,93 +12,9 @@ import java.io.Serializable;
* Describes the features of a spatially enabled dialect. * Describes the features of a spatially enabled dialect.
* *
* @author Karel Maesen * @author Karel Maesen
* * @deprecated To be removed in 6
*/ */
@Deprecated @Deprecated
public interface SpatialDialect extends Serializable { public interface SpatialDialect extends Serializable {
// /**
// * Returns the SQL fragment for the SQL WHERE-clause when parsing
// * <code>org.hibernatespatial.criterion.SpatialRelateExpression</code>s
// * into prepared statements.
// * <p/>
// *
// * @param columnName The name of the geometry-typed column to which the relation is
// * applied
// * @param spatialRelation The type of spatial relation (as defined in
// * <code>SpatialRelation</code>).
// *
// * @return SQL fragment {@code SpatialRelateExpression}
// */
// String getSpatialRelateSQL(String columnName, int spatialRelation);
//
// /**
// * Returns the SQL fragment for the SQL WHERE-expression when parsing
// * <code>org.hibernate.spatial.criterion.SpatialFilterExpression</code>s
// * into prepared statements.
// *
// * @param columnName The name of the geometry-typed column to which the filter is
// * be applied
// *
// * @return Rhe SQL fragment for the {@code SpatialFilterExpression}
// */
// String getSpatialFilterExpression(String columnName);
//
// /**
// * Returns the SQL fragment for the specfied Spatial aggregate expression.
// *
// * @param columnName The name of the Geometry property
// * @param aggregation The type of <code>SpatialAggregate</code>
// *
// * @return The SQL fragment for the projection
// */
// String getSpatialAggregateSQL(String columnName, int aggregation);
//
// /**
// * Returns The SQL fragment when parsing a <code>DWithinExpression</code>.
// *
// * @param columnName The geometry column to test against
// *
// * @return The SQL fragment when parsing a <code>DWithinExpression</code>.
// */
// String getDWithinSQL(String columnName);
//
// /**
// * Returns the SQL fragment when parsing a <code>HavingSridExpression</code>.
// *
// * @param columnName The geometry column to test against
// *
// * @return The SQL fragment for a <code>HavingSridExpression</code>.
// */
// String getHavingSridSQL(String columnName);
//
//
// /**
// * Returns the SQL fragment when parsing a <code>IsEmptyExpression</code> or
// * <code>IsNotEmpty</code> expression.
// *
// * @param columnName The geometry column
// * @param isEmpty Whether the geometry is tested for empty or non-empty
// *
// * @return The SQL fragment for the isempty function
// */
// String getIsEmptySQL(String columnName, boolean isEmpty);
//
// /**
// * Returns true if this <code>SpatialDialect</code> supports a specific filtering function.
// * <p> This is intended to signal DB-support for fast window queries, or MBR-overlap queries.</p>
// *
// * @return True if filtering is supported
// */
// boolean supportsFiltering();
//
// /**
// * Does this dialect supports the specified <code>SpatialFunction</code>.
// *
// * @param function <code>SpatialFunction</code>
// *
// * @return True if this <code>SpatialDialect</code> supports the spatial function specified by the function parameter.
// */
// boolean supports(SpatialFunction function);
} }

View File

@ -13,6 +13,7 @@ package org.hibernate.spatial;
* section 2.1.13.3. "</p> * section 2.1.13.3. "</p>
* *
* @author Karel Maesen * @author Karel Maesen
* @deprecated Will be removed in 6
*/ */
@Deprecated @Deprecated
public interface SpatialRelation { public interface SpatialRelation {

View File

@ -13,6 +13,7 @@ import org.hibernate.spatial.SpatialDialect;
/** /**
* An @{code SpatialDialect} for CockroachDB 20.2 and later. CockroachDB's spatial features where introduced in * An @{code SpatialDialect} for CockroachDB 20.2 and later. CockroachDB's spatial features where introduced in
* that version. * that version.
* @deprecated Spatial Dialects are no longer needed. Use the standard CockroachDB dialects
*/ */
@Deprecated @Deprecated
public class CockroachDB202SpatialDialect extends CockroachDialect implements SpatialDialect { public class CockroachDB202SpatialDialect extends CockroachDialect implements SpatialDialect {

View File

@ -38,4 +38,4 @@ public interface OracleSpatialAggregate extends org.hibernate.spatial.SpatialAgg
* CONVEXHULL aggregate function * CONVEXHULL aggregate function
*/ */
public static int CONVEXHULL = 104; public static int CONVEXHULL = 104;
} }

View File

@ -10,7 +10,6 @@ import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.Expression; import javax.persistence.criteria.Expression;
import javax.persistence.criteria.Predicate; import javax.persistence.criteria.Predicate;
import org.hibernate.NotYetImplementedFor6Exception;
import org.hibernate.spatial.SpatialFunction; import org.hibernate.spatial.SpatialFunction;
import org.geolatte.geom.Geometry; import org.geolatte.geom.Geometry;
@ -50,8 +49,7 @@ public class GeolatteSpatialPredicates {
Expression<? extends Geometry> geometry2) { Expression<? extends Geometry> geometry2) {
return booleanExpressionToPredicate( return booleanExpressionToPredicate(
criteriaBuilder, criteriaBuilder,
criteriaBuilder.function( ST_EQUALS.name(), boolean.class, criteriaBuilder.function( ST_EQUALS.name(), boolean.class, geometry1, geometry2
geometry1, geometry2
) )
); );
} }
@ -70,8 +68,7 @@ public class GeolatteSpatialPredicates {
public static Predicate eq( public static Predicate eq(
CriteriaBuilder criteriaBuilder, Expression<? extends Geometry> geometry1, CriteriaBuilder criteriaBuilder, Expression<? extends Geometry> geometry1,
Geometry geometry2) { Geometry geometry2) {
return eq( criteriaBuilder, geometry1, return eq( criteriaBuilder, geometry1, criteriaBuilder.literal( geometry2 )
criteriaBuilder.literal( geometry2 )
); );
} }
@ -129,8 +126,7 @@ public class GeolatteSpatialPredicates {
Expression<? extends Geometry> geometry2) { Expression<? extends Geometry> geometry2) {
return booleanExpressionToPredicate( return booleanExpressionToPredicate(
criteriaBuilder, criteriaBuilder,
criteriaBuilder.function( ST_CONTAINS.name(), boolean.class, criteriaBuilder.function( ST_CONTAINS.name(), boolean.class, geometry1, geometry2
geometry1, geometry2
) )
); );
} }
@ -149,8 +145,7 @@ public class GeolatteSpatialPredicates {
public static Predicate contains( public static Predicate contains(
CriteriaBuilder criteriaBuilder, Expression<? extends Geometry> geometry1, CriteriaBuilder criteriaBuilder, Expression<? extends Geometry> geometry1,
Geometry geometry2) { Geometry geometry2) {
return contains( criteriaBuilder, geometry1, return contains( criteriaBuilder, geometry1, criteriaBuilder.literal( geometry2 )
criteriaBuilder.literal( geometry2 )
); );
} }
@ -170,8 +165,7 @@ public class GeolatteSpatialPredicates {
Expression<? extends Geometry> geometry2) { Expression<? extends Geometry> geometry2) {
return booleanExpressionToPredicate( return booleanExpressionToPredicate(
criteriaBuilder, criteriaBuilder,
criteriaBuilder.function( ST_CROSSES.name(), boolean.class, criteriaBuilder.function( ST_CROSSES.name(), boolean.class, geometry1, geometry2
geometry1, geometry2
) )
); );
} }
@ -229,9 +223,7 @@ public class GeolatteSpatialPredicates {
public static Predicate disjoint( public static Predicate disjoint(
CriteriaBuilder criteriaBuilder, Expression<? extends Geometry> geometry1, CriteriaBuilder criteriaBuilder, Expression<? extends Geometry> geometry1,
Geometry geometry2) { Geometry geometry2) {
return disjoint( criteriaBuilder, geometry1, return disjoint( criteriaBuilder, geometry1, criteriaBuilder.literal( geometry2 ) );
criteriaBuilder.literal( geometry2 )
);
} }
/** /**
@ -365,9 +357,7 @@ public class GeolatteSpatialPredicates {
Expression<? extends Geometry> geometry2) { Expression<? extends Geometry> geometry2) {
return booleanExpressionToPredicate( return booleanExpressionToPredicate(
criteriaBuilder, criteriaBuilder,
criteriaBuilder.function( SpatialFunction.filter.toString(), boolean.class, criteriaBuilder.function( SpatialFunction.filter.toString(), boolean.class, geometry1, geometry2 )
geometry1, geometry2
)
); );
} }
@ -429,8 +419,12 @@ public class GeolatteSpatialPredicates {
Expression<? extends Geometry> geometry2, Expression<Double> distance) { Expression<? extends Geometry> geometry2, Expression<Double> distance) {
return booleanExpressionToPredicate( return booleanExpressionToPredicate(
criteriaBuilder, criteriaBuilder,
criteriaBuilder.function( SpatialFunction.dwithin.toString(), boolean.class, criteriaBuilder.function(
geometry1, geometry2, distance SpatialFunction.dwithin.toString(),
boolean.class,
geometry1,
geometry2,
distance
) )
); );
} }
@ -450,8 +444,7 @@ public class GeolatteSpatialPredicates {
public static Predicate distanceWithin( public static Predicate distanceWithin(
CriteriaBuilder criteriaBuilder, Expression<? extends Geometry> geometry1, CriteriaBuilder criteriaBuilder, Expression<? extends Geometry> geometry1,
Geometry geometry2, Expression<Double> distance) { Geometry geometry2, Expression<Double> distance) {
return distanceWithin( criteriaBuilder, geometry1, return distanceWithin( criteriaBuilder, geometry1, criteriaBuilder.literal( geometry2 ), distance
criteriaBuilder.literal( geometry2 ), distance
); );
} }
@ -470,8 +463,11 @@ public class GeolatteSpatialPredicates {
public static Predicate distanceWithin( public static Predicate distanceWithin(
CriteriaBuilder criteriaBuilder, Expression<? extends Geometry> geometry1, CriteriaBuilder criteriaBuilder, Expression<? extends Geometry> geometry1,
Geometry geometry2, double distance) { Geometry geometry2, double distance) {
return distanceWithin( criteriaBuilder, geometry1, return distanceWithin(
criteriaBuilder.literal( geometry2 ), criteriaBuilder.literal( distance ) criteriaBuilder,
geometry1,
criteriaBuilder.literal( geometry2 ),
criteriaBuilder.literal( distance )
); );
} }
@ -490,8 +486,7 @@ public class GeolatteSpatialPredicates {
public static Predicate distanceWithin( public static Predicate distanceWithin(
CriteriaBuilder criteriaBuilder, Expression<? extends Geometry> geometry1, CriteriaBuilder criteriaBuilder, Expression<? extends Geometry> geometry1,
Expression<? extends Geometry> geometry2, double distance) { Expression<? extends Geometry> geometry2, double distance) {
return distanceWithin( criteriaBuilder, geometry1, geometry2, return distanceWithin( criteriaBuilder, geometry1, geometry2, criteriaBuilder.literal( distance )
criteriaBuilder.literal( distance )
); );
} }
@ -529,9 +524,7 @@ public class GeolatteSpatialPredicates {
public static Predicate havingSRID( public static Predicate havingSRID(
CriteriaBuilder criteriaBuilder, Expression<? extends Geometry> geometry, CriteriaBuilder criteriaBuilder, Expression<? extends Geometry> geometry,
int srid) { int srid) {
return havingSRID( criteriaBuilder, geometry, return havingSRID( criteriaBuilder, geometry, criteriaBuilder.literal( srid ) );
criteriaBuilder.literal( srid )
);
} }
/** /**
@ -547,9 +540,7 @@ public class GeolatteSpatialPredicates {
public static Predicate isEmpty(CriteriaBuilder criteriaBuilder, Expression<? extends Geometry> geometry) { public static Predicate isEmpty(CriteriaBuilder criteriaBuilder, Expression<? extends Geometry> geometry) {
return booleanExpressionToPredicate( return booleanExpressionToPredicate(
criteriaBuilder, criteriaBuilder,
criteriaBuilder.function( SpatialFunction.isempty.toString(), boolean.class, criteriaBuilder.function( SpatialFunction.isempty.toString(), boolean.class, geometry )
geometry
)
); );
} }

View File

@ -10,7 +10,6 @@ import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.Expression; import javax.persistence.criteria.Expression;
import javax.persistence.criteria.Predicate; import javax.persistence.criteria.Predicate;
import org.hibernate.NotYetImplementedFor6Exception;
import org.hibernate.spatial.SpatialFunction; import org.hibernate.spatial.SpatialFunction;
import org.locationtech.jts.geom.Geometry; import org.locationtech.jts.geom.Geometry;
@ -136,9 +135,7 @@ public class JTSSpatialPredicates {
public static Predicate contains( public static Predicate contains(
CriteriaBuilder criteriaBuilder, Expression<? extends Geometry> geometry1, CriteriaBuilder criteriaBuilder, Expression<? extends Geometry> geometry1,
Geometry geometry2) { Geometry geometry2) {
return contains( criteriaBuilder, geometry1, return contains( criteriaBuilder, geometry1, criteriaBuilder.literal( geometry2 ) );
criteriaBuilder.literal( geometry2 )
);
} }
/** /**
@ -155,9 +152,7 @@ public class JTSSpatialPredicates {
Expression<? extends Geometry> geometry2) { Expression<? extends Geometry> geometry2) {
return booleanExpressionToPredicate( return booleanExpressionToPredicate(
criteriaBuilder, criteriaBuilder,
criteriaBuilder.function( ST_CROSSES.name(), boolean.class, criteriaBuilder.function( ST_CROSSES.name(), boolean.class, geometry1, geometry2 )
geometry1, geometry2
)
); );
} }
@ -212,9 +207,7 @@ public class JTSSpatialPredicates {
public static Predicate disjoint( public static Predicate disjoint(
CriteriaBuilder criteriaBuilder, Expression<? extends Geometry> geometry1, CriteriaBuilder criteriaBuilder, Expression<? extends Geometry> geometry1,
Geometry geometry2) { Geometry geometry2) {
return disjoint( criteriaBuilder, geometry1, return disjoint( criteriaBuilder, geometry1, criteriaBuilder.literal( geometry2 ) );
criteriaBuilder.literal( geometry2 )
);
} }
/** /**
@ -326,7 +319,6 @@ public class JTSSpatialPredicates {
} }
// /** // /**
// * Create a predicate for testing the arguments for bounding box overlap constraint. // * Create a predicate for testing the arguments for bounding box overlap constraint.
// * // *
@ -399,8 +391,12 @@ public class JTSSpatialPredicates {
Expression<? extends Geometry> geometry2, Expression<Double> distance) { Expression<? extends Geometry> geometry2, Expression<Double> distance) {
return booleanExpressionToPredicate( return booleanExpressionToPredicate(
criteriaBuilder, criteriaBuilder,
criteriaBuilder.function( SpatialFunction.dwithin.toString(), boolean.class, criteriaBuilder.function(
geometry1, geometry2, distance SpatialFunction.dwithin.toString(),
boolean.class,
geometry1,
geometry2,
distance
) )
); );
} }
@ -420,9 +416,7 @@ public class JTSSpatialPredicates {
public static Predicate distanceWithin( public static Predicate distanceWithin(
CriteriaBuilder criteriaBuilder, Expression<? extends Geometry> geometry1, CriteriaBuilder criteriaBuilder, Expression<? extends Geometry> geometry1,
Geometry geometry2, Expression<Double> distance) { Geometry geometry2, Expression<Double> distance) {
return distanceWithin( criteriaBuilder, geometry1, return distanceWithin( criteriaBuilder, geometry1, criteriaBuilder.literal( geometry2 ), distance );
criteriaBuilder.literal( geometry2 ), distance
);
} }
/** /**
@ -440,8 +434,11 @@ public class JTSSpatialPredicates {
public static Predicate distanceWithin( public static Predicate distanceWithin(
CriteriaBuilder criteriaBuilder, Expression<? extends Geometry> geometry1, CriteriaBuilder criteriaBuilder, Expression<? extends Geometry> geometry1,
Geometry geometry2, double distance) { Geometry geometry2, double distance) {
return distanceWithin( criteriaBuilder, geometry1, return distanceWithin(
criteriaBuilder.literal( geometry2 ), criteriaBuilder.literal( distance ) criteriaBuilder,
geometry1,
criteriaBuilder.literal( geometry2 ),
criteriaBuilder.literal( distance )
); );
} }
@ -460,9 +457,7 @@ public class JTSSpatialPredicates {
public static Predicate distanceWithin( public static Predicate distanceWithin(
CriteriaBuilder criteriaBuilder, Expression<? extends Geometry> geometry1, CriteriaBuilder criteriaBuilder, Expression<? extends Geometry> geometry1,
Expression<? extends Geometry> geometry2, double distance) { Expression<? extends Geometry> geometry2, double distance) {
return distanceWithin( criteriaBuilder, geometry1, geometry2, return distanceWithin( criteriaBuilder, geometry1, geometry2, criteriaBuilder.literal( distance ) );
criteriaBuilder.literal( distance )
);
} }
/** /**
@ -497,9 +492,7 @@ public class JTSSpatialPredicates {
public static Predicate havingSRID( public static Predicate havingSRID(
CriteriaBuilder criteriaBuilder, Expression<? extends Geometry> geometry, CriteriaBuilder criteriaBuilder, Expression<? extends Geometry> geometry,
int srid) { int srid) {
return havingSRID( criteriaBuilder, geometry, return havingSRID( criteriaBuilder, geometry, criteriaBuilder.literal( srid ) );
criteriaBuilder.literal( srid )
);
} }
/** /**
@ -513,9 +506,7 @@ public class JTSSpatialPredicates {
public static Predicate isEmpty(CriteriaBuilder criteriaBuilder, Expression<? extends Geometry> geometry) { public static Predicate isEmpty(CriteriaBuilder criteriaBuilder, Expression<? extends Geometry> geometry) {
return booleanExpressionToPredicate( return booleanExpressionToPredicate(
criteriaBuilder, criteriaBuilder,
criteriaBuilder.function( SpatialFunction.isempty.toString(), boolean.class, criteriaBuilder.function( SpatialFunction.isempty.toString(), boolean.class, geometry )
geometry
)
); );
} }