Remove readOptionalQuery

Replace it with readOptionalNamedWriteable
This commit is contained in:
Nik Everett 2016-04-18 14:33:20 -04:00
parent 68b4371bd9
commit 8cffe0fc28
4 changed files with 13 additions and 13 deletions

View File

@ -729,6 +729,16 @@ public abstract class StreamInput extends InputStream {
throw new UnsupportedOperationException("can't read named writeable from StreamInput");
}
/**
* Reads an optional {@link QueryBuilder}.
*/
public <C extends NamedWriteable<?>> C readOptionalNamedWriteable(Class<C> categoryClass) throws IOException {
if (readBoolean()) {
return readNamedWriteable(categoryClass);
}
return null;
}
/**
* Reads a {@link AggregatorBuilder} from the current stream
*/
@ -750,16 +760,6 @@ public abstract class StreamInput extends InputStream {
return readNamedWriteable(QueryBuilder.class);
}
/**
* Reads an optional {@link QueryBuilder}.
*/
public QueryBuilder<?> readOptionalQuery() throws IOException {
if (readBoolean()) {
return readNamedWriteable(QueryBuilder.class);
}
return null;
}
/**
* Reads a {@link ShapeBuilder} from the current stream
*/

View File

@ -101,7 +101,7 @@ public class FieldSortBuilder extends SortBuilder<FieldSortBuilder> {
*/
public FieldSortBuilder(StreamInput in) throws IOException {
fieldName = in.readString();
nestedFilter = in.readOptionalQuery();
nestedFilter = in.readOptionalNamedWriteable(QueryBuilder.class);
nestedPath = in.readOptionalString();
missing = in.readGenericValue();
order = in.readOptionalWriteable(SortOrder::readFromStream);

View File

@ -159,7 +159,7 @@ public class GeoDistanceSortBuilder extends SortBuilder<GeoDistanceSortBuilder>
unit = DistanceUnit.readFromStream(in);
order = SortOrder.readFromStream(in);
sortMode = in.readOptionalWriteable(SortMode::readFromStream);
nestedFilter = in.readOptionalQuery();
nestedFilter = in.readOptionalNamedWriteable(QueryBuilder.class);
nestedPath = in.readOptionalString();
coerce = in.readBoolean();
ignoreMalformed =in.readBoolean();

View File

@ -118,7 +118,7 @@ public class ScriptSortBuilder extends SortBuilder<ScriptSortBuilder> {
order = SortOrder.readFromStream(in);
sortMode = in.readOptionalWriteable(SortMode::readFromStream);
nestedPath = in.readOptionalString();
nestedFilter = in.readOptionalQuery();
nestedFilter = in.readOptionalNamedWriteable(QueryBuilder.class);
}
@Override