Replace (read|write)Shape with (read|write)NamedWriteable

This commit is contained in:
Nik Everett 2016-04-18 14:43:40 -04:00
parent d22603831d
commit d1722c9908
4 changed files with 4 additions and 18 deletions

View File

@ -53,7 +53,7 @@ public class GeometryCollectionBuilder extends ShapeBuilder {
public GeometryCollectionBuilder(StreamInput in) throws IOException { public GeometryCollectionBuilder(StreamInput in) throws IOException {
int shapes = in.readVInt(); int shapes = in.readVInt();
for (int i = 0; i < shapes; i++) { for (int i = 0; i < shapes; i++) {
shape(in.readShape()); shape(in.readNamedWriteable(ShapeBuilder.class));
} }
} }
@ -61,7 +61,7 @@ public class GeometryCollectionBuilder extends ShapeBuilder {
public void writeTo(StreamOutput out) throws IOException { public void writeTo(StreamOutput out) throws IOException {
out.writeVInt(shapes.size()); out.writeVInt(shapes.size());
for (ShapeBuilder shape : shapes) { for (ShapeBuilder shape : shapes) {
out.writeShape(shape); out.writeNamedWriteable(shape);
} }
} }

View File

@ -746,13 +746,6 @@ public abstract class StreamInput extends InputStream {
return readNamedWriteable(QueryBuilder.class); return readNamedWriteable(QueryBuilder.class);
} }
/**
* Reads a {@link ShapeBuilder} from the current stream
*/
public ShapeBuilder readShape() throws IOException {
return readNamedWriteable(ShapeBuilder.class);
}
/** /**
* Reads a {@link RescoreBuilder} from the current stream * Reads a {@link RescoreBuilder} from the current stream
*/ */

View File

@ -711,13 +711,6 @@ public abstract class StreamOutput extends OutputStream {
writeNamedWriteable(queryBuilder); writeNamedWriteable(queryBuilder);
} }
/**
* Writes a {@link ShapeBuilder} to the current stream
*/
public void writeShape(ShapeBuilder shapeBuilder) throws IOException {
writeNamedWriteable(shapeBuilder);
}
/** /**
* Writes a {@link ScoreFunctionBuilder} to the current stream * Writes a {@link ScoreFunctionBuilder} to the current stream
*/ */

View File

@ -144,7 +144,7 @@ public class GeoShapeQueryBuilder extends AbstractQueryBuilder<GeoShapeQueryBuil
super(in); super(in);
fieldName = in.readString(); fieldName = in.readString();
if (in.readBoolean()) { if (in.readBoolean()) {
shape = in.readShape(); shape = in.readNamedWriteable(ShapeBuilder.class);
indexedShapeId = null; indexedShapeId = null;
indexedShapeType = null; indexedShapeType = null;
} else { } else {
@ -165,7 +165,7 @@ public class GeoShapeQueryBuilder extends AbstractQueryBuilder<GeoShapeQueryBuil
boolean hasShape = shape != null; boolean hasShape = shape != null;
out.writeBoolean(hasShape); out.writeBoolean(hasShape);
if (hasShape) { if (hasShape) {
out.writeShape(shape); out.writeNamedWriteable(shape);
} else { } else {
out.writeOptionalString(indexedShapeId); out.writeOptionalString(indexedShapeId);
out.writeOptionalString(indexedShapeType); out.writeOptionalString(indexedShapeType);