Deprecate remaining readXYZ|writeXYZ methods

This commit is contained in:
Nik Everett 2016-04-18 15:04:23 -04:00
parent 98fa71868c
commit ff9b28d806
3 changed files with 37 additions and 3 deletions

View File

@ -737,56 +737,72 @@ public abstract class StreamInput extends InputStream {
/** /**
* Reads a {@link QueryBuilder} from the current stream * Reads a {@link QueryBuilder} from the current stream
* @deprecated prefer {@link #readNamedWriteable(Class)} passing {@link QueryBuilder}.
*/ */
@Deprecated
public QueryBuilder<?> readQuery() throws IOException { public QueryBuilder<?> readQuery() throws IOException {
return readNamedWriteable(QueryBuilder.class); return readNamedWriteable(QueryBuilder.class);
} }
/** /**
* Reads a {@link SuggestionBuilder} from the current stream * Reads a {@link SuggestionBuilder} from the current stream
* @deprecated prefer {@link #readNamedWriteable(Class)} passing {@link SuggestionBuilder}.
*/ */
@Deprecated
public SuggestionBuilder<?> readSuggestion() throws IOException { public SuggestionBuilder<?> readSuggestion() throws IOException {
return readNamedWriteable(SuggestionBuilder.class); return readNamedWriteable(SuggestionBuilder.class);
} }
/** /**
* Reads a {@link SortBuilder} from the current stream * Reads a {@link SortBuilder} from the current stream
* @deprecated prefer {@link #readNamedWriteable(Class)} passing {@link SortBuilder}.
*/ */
@Deprecated
public SortBuilder<?> readSortBuilder() throws IOException { public SortBuilder<?> readSortBuilder() throws IOException {
return readNamedWriteable(SortBuilder.class); return readNamedWriteable(SortBuilder.class);
} }
/** /**
* Reads a {@link org.elasticsearch.index.query.functionscore.ScoreFunctionBuilder} from the current stream * Reads a {@link org.elasticsearch.index.query.functionscore.ScoreFunctionBuilder} from the current stream
* @deprecated prefer {@link #readNamedWriteable(Class)} passing {@link ScoreFunctionBuilder}.
*/ */
@Deprecated
public ScoreFunctionBuilder<?> readScoreFunction() throws IOException { public ScoreFunctionBuilder<?> readScoreFunction() throws IOException {
return readNamedWriteable(ScoreFunctionBuilder.class); return readNamedWriteable(ScoreFunctionBuilder.class);
} }
/** /**
* Reads a {@link SmoothingModel} from the current stream * Reads a {@link SmoothingModel} from the current stream
* @deprecated prefer {@link #readNamedWriteable(Class)} passing {@link SmoothingModel}.
*/ */
@Deprecated
public SmoothingModel readPhraseSuggestionSmoothingModel() throws IOException { public SmoothingModel readPhraseSuggestionSmoothingModel() throws IOException {
return readNamedWriteable(SmoothingModel.class); return readNamedWriteable(SmoothingModel.class);
} }
/** /**
* Reads a {@link Task.Status} from the current stream. * Reads a {@link Task.Status} from the current stream.
* @deprecated prefer {@link #readNamedWriteable(Class)} passing {@link Task.Status}.
*/ */
@Deprecated
public Task.Status readTaskStatus() throws IOException { public Task.Status readTaskStatus() throws IOException {
return readNamedWriteable(Task.Status.class); return readNamedWriteable(Task.Status.class);
} }
/** /**
* Reads a {@link DocValueFormat} from the current stream. * Reads a {@link DocValueFormat} from the current stream.
* @deprecated prefer {@link #readNamedWriteable(Class)} passing {@link DocValueFormat}.
*/ */
@Deprecated
public DocValueFormat readValueFormat() throws IOException { public DocValueFormat readValueFormat() throws IOException {
return readNamedWriteable(DocValueFormat.class); return readNamedWriteable(DocValueFormat.class);
} }
/** /**
* Reads an {@link AllocationCommand} from the stream. * Reads an {@link AllocationCommand} from the stream.
* @deprecated prefer {@link #readNamedWriteable(Class)} passing {@link AllocationCommand}.
*/ */
@Deprecated
public AllocationCommand readAllocationCommand() throws IOException { public AllocationCommand readAllocationCommand() throws IOException {
return readNamedWriteable(AllocationCommand.class); return readNamedWriteable(AllocationCommand.class);
} }

View File

@ -702,28 +702,36 @@ public abstract class StreamOutput extends OutputStream {
/** /**
* Writes a {@link QueryBuilder} to the current stream * Writes a {@link QueryBuilder} to the current stream
* @deprecated prefer {@link #writeNamedWriteable(NamedWriteable)}
*/ */
@Deprecated
public void writeQuery(QueryBuilder<?> queryBuilder) throws IOException { public void writeQuery(QueryBuilder<?> queryBuilder) throws IOException {
writeNamedWriteable(queryBuilder); writeNamedWriteable(queryBuilder);
} }
/** /**
* Writes a {@link ScoreFunctionBuilder} to the current stream * Writes a {@link ScoreFunctionBuilder} to the current stream
* @deprecated prefer {@link #writeNamedWriteable(NamedWriteable)}
*/ */
@Deprecated
public void writeScoreFunction(ScoreFunctionBuilder<?> scoreFunctionBuilder) throws IOException { public void writeScoreFunction(ScoreFunctionBuilder<?> scoreFunctionBuilder) throws IOException {
writeNamedWriteable(scoreFunctionBuilder); writeNamedWriteable(scoreFunctionBuilder);
} }
/** /**
* Writes the given {@link SmoothingModel} to the stream * Writes the given {@link SmoothingModel} to the stream
* @deprecated prefer {@link #writeNamedWriteable(NamedWriteable)}
*/ */
@Deprecated
public void writePhraseSuggestionSmoothingModel(SmoothingModel smoothinModel) throws IOException { public void writePhraseSuggestionSmoothingModel(SmoothingModel smoothinModel) throws IOException {
writeNamedWriteable(smoothinModel); writeNamedWriteable(smoothinModel);
} }
/** /**
* Writes a {@link Task.Status} to the current stream. * Writes a {@link Task.Status} to the current stream.
* @deprecated prefer {@link #writeNamedWriteable(NamedWriteable)}
*/ */
@Deprecated
public void writeTaskStatus(Task.Status status) throws IOException { public void writeTaskStatus(Task.Status status) throws IOException {
writeNamedWriteable(status); writeNamedWriteable(status);
} }
@ -767,26 +775,36 @@ public abstract class StreamOutput extends OutputStream {
/** /**
* Writes a {@link SuggestionBuilder} to the current stream * Writes a {@link SuggestionBuilder} to the current stream
* @deprecated prefer {@link #writeNamedWriteable(NamedWriteable)}
*/ */
@Deprecated
public void writeSuggestion(SuggestionBuilder<?> suggestion) throws IOException { public void writeSuggestion(SuggestionBuilder<?> suggestion) throws IOException {
writeNamedWriteable(suggestion); writeNamedWriteable(suggestion);
} }
/** /**
* Writes a {@link SortBuilder} to the current stream * Writes a {@link SortBuilder} to the current stream
* @deprecated prefer {@link #writeNamedWriteable(NamedWriteable)}
*/ */
@Deprecated
public void writeSortBuilder(SortBuilder<?> sort) throws IOException { public void writeSortBuilder(SortBuilder<?> sort) throws IOException {
writeNamedWriteable(sort); writeNamedWriteable(sort);
} }
/** Writes a {@link DocValueFormat}. */ /**
* Writes a {@link DocValueFormat}.
* @deprecated prefer {@link #writeNamedWriteable(NamedWriteable)}
*/
@Deprecated
public void writeValueFormat(DocValueFormat format) throws IOException { public void writeValueFormat(DocValueFormat format) throws IOException {
writeNamedWriteable(format); writeNamedWriteable(format);
} }
/** /**
* Writes an {@link AllocationCommand} to the stream. * Writes an {@link AllocationCommand} to the stream.
* @deprecated prefer {@link #writeNamedWriteable(NamedWriteable)}
*/ */
@Deprecated
public void writeAllocationCommand(AllocationCommand command) throws IOException { public void writeAllocationCommand(AllocationCommand command) throws IOException {
writeNamedWriteable(command); writeNamedWriteable(command);
} }

View File

@ -208,7 +208,7 @@ public class DeleteByQueryRequest extends ActionRequest<DeleteByQueryRequest> im
indices = in.readStringArray(); indices = in.readStringArray();
indicesOptions = IndicesOptions.readIndicesOptions(in); indicesOptions = IndicesOptions.readIndicesOptions(in);
types = in.readStringArray(); types = in.readStringArray();
query = in.readQuery(); query = in.readNamedWriteable(QueryBuilder.class);
routing = in.readOptionalString(); routing = in.readOptionalString();
size = in.readVInt(); size = in.readVInt();
if (in.readBoolean()) { if (in.readBoolean()) {
@ -225,7 +225,7 @@ public class DeleteByQueryRequest extends ActionRequest<DeleteByQueryRequest> im
out.writeStringArray(indices); out.writeStringArray(indices);
indicesOptions.writeIndicesOptions(out); indicesOptions.writeIndicesOptions(out);
out.writeStringArray(types); out.writeStringArray(types);
out.writeQuery(query); out.writeNamedWriteable(query);
out.writeOptionalString(routing); out.writeOptionalString(routing);
out.writeVInt(size); out.writeVInt(size);
out.writeOptionalStreamable(scroll); out.writeOptionalStreamable(scroll);