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
* @deprecated prefer {@link #readNamedWriteable(Class)} passing {@link QueryBuilder}.
*/
@Deprecated
public QueryBuilder<?> readQuery() throws IOException {
return readNamedWriteable(QueryBuilder.class);
}
/**
* Reads a {@link SuggestionBuilder} from the current stream
* @deprecated prefer {@link #readNamedWriteable(Class)} passing {@link SuggestionBuilder}.
*/
@Deprecated
public SuggestionBuilder<?> readSuggestion() throws IOException {
return readNamedWriteable(SuggestionBuilder.class);
}
/**
* Reads a {@link SortBuilder} from the current stream
* @deprecated prefer {@link #readNamedWriteable(Class)} passing {@link SortBuilder}.
*/
@Deprecated
public SortBuilder<?> readSortBuilder() throws IOException {
return readNamedWriteable(SortBuilder.class);
}
/**
* 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 {
return readNamedWriteable(ScoreFunctionBuilder.class);
}
/**
* Reads a {@link SmoothingModel} from the current stream
* @deprecated prefer {@link #readNamedWriteable(Class)} passing {@link SmoothingModel}.
*/
@Deprecated
public SmoothingModel readPhraseSuggestionSmoothingModel() throws IOException {
return readNamedWriteable(SmoothingModel.class);
}
/**
* 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 {
return readNamedWriteable(Task.Status.class);
}
/**
* Reads a {@link DocValueFormat} from the current stream.
* @deprecated prefer {@link #readNamedWriteable(Class)} passing {@link DocValueFormat}.
*/
@Deprecated
public DocValueFormat readValueFormat() throws IOException {
return readNamedWriteable(DocValueFormat.class);
}
/**
* Reads an {@link AllocationCommand} from the stream.
* @deprecated prefer {@link #readNamedWriteable(Class)} passing {@link AllocationCommand}.
*/
@Deprecated
public AllocationCommand readAllocationCommand() throws IOException {
return readNamedWriteable(AllocationCommand.class);
}

View File

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

View File

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