#2105 - Refactor extract interface DataBinder from DataBind

This commit is contained in:
rob bygrave committed 2020-11-19 14:52:19 +13:00
1 parent 29345c823e
commit 0bfb6895ad
72 files changed
+558 -440

No files matched your search

@@ -1,6 +1,6 @@
package io.ebean.postgis;
import io.ebeaninternal.server.type.DataBind;
import io.ebeaninternal.server.type.DataBinder;
import io.ebeaninternal.server.type.GeoTypeBinder;
import org.geolatte.geom.codec.Wkt;
import org.postgis.Geometry;
@@ -17,11 +17,11 @@ class PostgisGeoTypeBinder implements GeoTypeBinder {
}
@Override
public void bind(DataBind b, int dataType, Object data) throws SQLException {
public void bind(DataBinder binder, int dataType, Object data) throws SQLException {
if (data instanceof Geometry) {
b.setObject(new PGgeometryLW((Geometry) data));
binder.setObject(new PGgeometryLW((Geometry) data));
} else if (withGeolatte) {
b.setObject(new PGgeometryLW(toWktString(data)));
binder.setObject(new PGgeometryLW(toWktString(data)));
}
}
@@ -2,7 +2,7 @@ package io.ebean.postgis;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonParser;
import io.ebeaninternal.server.type.DataBind;
import io.ebeaninternal.server.type.DataBinder;
import io.ebeaninternal.server.type.DataReader;
import io.ebeaninternal.server.type.ScalarType;
import io.ebeanservice.docstore.api.mapping.DocPropertyType;
@@ -28,11 +28,11 @@ abstract class ScalarTypePgisBase<T extends Geometry> implements ScalarType<T> {
}
@Override
public void bind(DataBind bind, T value) throws SQLException {
public void bind(DataBinder binder, T value) throws SQLException {
if (value == null) {
bind.setNull(Types.NULL);
binder.setNull(Types.NULL);
} else {
bind.setObject(new PGgeometryLW(value));
binder.setObject(new PGgeometryLW(value));
}
}
@@ -40,7 +40,6 @@ abstract class ScalarTypePgisBase<T extends Geometry> implements ScalarType<T> {
@Override
@SuppressWarnings("unchecked")
public T read(DataReader reader) throws SQLException {
Object object = reader.getObject();
if (object == null) {
return null;
@@ -2,7 +2,7 @@ package io.ebean.postgis.latte;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonParser;
import io.ebeaninternal.server.type.DataBind;
import io.ebeaninternal.server.type.DataBinder;
import io.ebeaninternal.server.type.DataReader;
import io.ebeaninternal.server.type.ScalarType;
import io.ebeanservice.docstore.api.mapping.DocPropertyType;
@@ -43,13 +43,12 @@ abstract class ScalarTypeGeoLatteBase<T extends Geometry> implements ScalarType<
}
@Override
public void bind(DataBind bind, T value) throws SQLException {
public void bind(DataBinder binder, T value) throws SQLException {
if (value == null) {
bind.setNull(Types.OTHER);
binder.setNull(Types.OTHER);
} else {
String wkt = Wkt.newEncoder(Wkt.Dialect.POSTGIS_EWKT_1).encode(value);
bind.setObject(new PGgeometryLW(wkt));
binder.setObject(new PGgeometryLW(wkt));
}
}
@@ -57,7 +56,6 @@ abstract class ScalarTypeGeoLatteBase<T extends Geometry> implements ScalarType<
@Override
@SuppressWarnings("unchecked")
public T read(DataReader reader) throws SQLException {
Object object = reader.getObject();
if (object == null) {
return null;