Remove @Required annotation

The @Required annotation is used for documentation purposes only anyway.
This commit is contained in:
Alexander Reelsen 2013-10-07 10:35:34 +02:00
parent abcf8fc0f7
commit a03013ea25
10 changed files with 0 additions and 86 deletions

View File

@ -23,7 +23,6 @@ import org.elasticsearch.ElasticSearchGenerationException;
import org.elasticsearch.ElasticSearchIllegalArgumentException;
import org.elasticsearch.action.ActionRequestValidationException;
import org.elasticsearch.action.support.master.MasterNodeOperationRequest;
import org.elasticsearch.common.Required;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
@ -111,7 +110,6 @@ public class PutMappingRequest extends MasterNodeOperationRequest<PutMappingRequ
/**
* The type of the mappings.
*/
@Required
public PutMappingRequest type(String type) {
this.type = type;
return this;
@ -166,7 +164,6 @@ public class PutMappingRequest extends MasterNodeOperationRequest<PutMappingRequ
/**
* The mapping source definition.
*/
@Required
public PutMappingRequest source(XContentBuilder mappingBuilder) {
try {
return source(mappingBuilder.string());
@ -178,7 +175,6 @@ public class PutMappingRequest extends MasterNodeOperationRequest<PutMappingRequ
/**
* The mapping source definition.
*/
@Required
public PutMappingRequest source(Map mappingSource) {
try {
XContentBuilder builder = XContentFactory.contentBuilder(XContentType.JSON);
@ -192,7 +188,6 @@ public class PutMappingRequest extends MasterNodeOperationRequest<PutMappingRequ
/**
* The mapping source definition.
*/
@Required
public PutMappingRequest source(String mappingSource) {
this.source = mappingSource;
return this;

View File

@ -23,7 +23,6 @@ import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.support.master.MasterNodeOperationRequestBuilder;
import org.elasticsearch.client.IndicesAdminClient;
import org.elasticsearch.client.internal.InternalIndicesAdminClient;
import org.elasticsearch.common.Required;
import org.elasticsearch.common.unit.TimeValue;
import org.elasticsearch.common.xcontent.XContentBuilder;
@ -46,7 +45,6 @@ public class PutMappingRequestBuilder extends MasterNodeOperationRequestBuilder<
/**
* The type of the mappings.
*/
@Required
public PutMappingRequestBuilder setType(String type) {
request.type(type);
return this;

View File

@ -23,7 +23,6 @@ import org.elasticsearch.ElasticSearchGenerationException;
import org.elasticsearch.action.ActionRequestValidationException;
import org.elasticsearch.action.support.broadcast.BroadcastOperationRequest;
import org.elasticsearch.client.Requests;
import org.elasticsearch.common.Required;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.bytes.BytesArray;
import org.elasticsearch.common.bytes.BytesReference;
@ -95,7 +94,6 @@ public class ValidateQueryRequest extends BroadcastOperationRequest<ValidateQuer
*
* @see org.elasticsearch.index.query.QueryBuilders
*/
@Required
public ValidateQueryRequest query(QueryBuilder queryBuilder) {
this.querySource = queryBuilder.buildAsBytes();
this.querySourceUnsafe = false;
@ -105,7 +103,6 @@ public class ValidateQueryRequest extends BroadcastOperationRequest<ValidateQuer
/**
* The query source to execute in the form of a map.
*/
@Required
public ValidateQueryRequest query(Map querySource) {
try {
XContentBuilder builder = XContentFactory.contentBuilder(contentType);
@ -116,7 +113,6 @@ public class ValidateQueryRequest extends BroadcastOperationRequest<ValidateQuer
}
}
@Required
public ValidateQueryRequest query(XContentBuilder builder) {
this.querySource = builder.bytes();
this.querySourceUnsafe = false;
@ -127,7 +123,6 @@ public class ValidateQueryRequest extends BroadcastOperationRequest<ValidateQuer
* The query source to validate. It is preferable to use either {@link #query(byte[])}
* or {@link #query(org.elasticsearch.index.query.QueryBuilder)}.
*/
@Required
public ValidateQueryRequest query(String querySource) {
this.querySource = new BytesArray(querySource);
this.querySourceUnsafe = false;
@ -137,7 +132,6 @@ public class ValidateQueryRequest extends BroadcastOperationRequest<ValidateQuer
/**
* The query source to validate.
*/
@Required
public ValidateQueryRequest query(byte[] querySource) {
return query(querySource, 0, querySource.length, false);
}
@ -145,7 +139,6 @@ public class ValidateQueryRequest extends BroadcastOperationRequest<ValidateQuer
/**
* The query source to validate.
*/
@Required
public ValidateQueryRequest query(byte[] querySource, int offset, int length, boolean unsafe) {
return query(new BytesArray(querySource, offset, length), unsafe);
}
@ -153,7 +146,6 @@ public class ValidateQueryRequest extends BroadcastOperationRequest<ValidateQuer
/**
* The query source to validate.
*/
@Required
public ValidateQueryRequest query(BytesReference querySource, boolean unsafe) {
this.querySource = querySource;
this.querySourceUnsafe = unsafe;

View File

@ -24,7 +24,6 @@ import org.elasticsearch.action.ActionRequestValidationException;
import org.elasticsearch.action.support.broadcast.BroadcastOperationRequest;
import org.elasticsearch.client.Requests;
import org.elasticsearch.common.Nullable;
import org.elasticsearch.common.Required;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.bytes.BytesArray;
import org.elasticsearch.common.bytes.BytesReference;
@ -125,7 +124,6 @@ public class CountRequest extends BroadcastOperationRequest<CountRequest> {
*
* @see org.elasticsearch.index.query.QueryBuilders
*/
@Required
public CountRequest query(QueryBuilder queryBuilder) {
this.querySource = queryBuilder.buildAsBytes();
this.querySourceUnsafe = false;
@ -135,7 +133,6 @@ public class CountRequest extends BroadcastOperationRequest<CountRequest> {
/**
* The query source to execute in the form of a map.
*/
@Required
public CountRequest query(Map querySource) {
try {
XContentBuilder builder = XContentFactory.contentBuilder(contentType);
@ -146,7 +143,6 @@ public class CountRequest extends BroadcastOperationRequest<CountRequest> {
}
}
@Required
public CountRequest query(XContentBuilder builder) {
this.querySource = builder.bytes();
this.querySourceUnsafe = false;
@ -157,7 +153,6 @@ public class CountRequest extends BroadcastOperationRequest<CountRequest> {
* The query source to execute. It is preferable to use either {@link #query(byte[])}
* or {@link #query(org.elasticsearch.index.query.QueryBuilder)}.
*/
@Required
public CountRequest query(String querySource) {
this.querySource = new BytesArray(querySource);
this.querySourceUnsafe = false;
@ -167,7 +162,6 @@ public class CountRequest extends BroadcastOperationRequest<CountRequest> {
/**
* The query source to execute.
*/
@Required
public CountRequest query(byte[] querySource) {
return query(querySource, 0, querySource.length, false);
}
@ -175,12 +169,10 @@ public class CountRequest extends BroadcastOperationRequest<CountRequest> {
/**
* The query source to execute.
*/
@Required
public CountRequest query(byte[] querySource, int offset, int length, boolean unsafe) {
return query(new BytesArray(querySource, offset, length), unsafe);
}
@Required
public CountRequest query(BytesReference querySource, boolean unsafe) {
this.querySource = querySource;
this.querySourceUnsafe = unsafe;

View File

@ -22,7 +22,6 @@ package org.elasticsearch.action.delete;
import org.elasticsearch.action.ActionRequestValidationException;
import org.elasticsearch.action.support.replication.ShardReplicationOperationRequest;
import org.elasticsearch.common.Nullable;
import org.elasticsearch.common.Required;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.index.VersionType;
@ -108,7 +107,6 @@ public class DeleteRequest extends ShardReplicationOperationRequest<DeleteReques
/**
* Sets the type of the document to delete.
*/
@Required
public DeleteRequest type(String type) {
this.type = type;
return this;
@ -124,7 +122,6 @@ public class DeleteRequest extends ShardReplicationOperationRequest<DeleteReques
/**
* Sets the id of the document to delete.
*/
@Required
public DeleteRequest id(String id) {
this.id = id;
return this;

View File

@ -25,7 +25,6 @@ import org.elasticsearch.action.ActionRequestValidationException;
import org.elasticsearch.action.support.replication.IndicesReplicationOperationRequest;
import org.elasticsearch.client.Requests;
import org.elasticsearch.common.Nullable;
import org.elasticsearch.common.Required;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.bytes.BytesArray;
import org.elasticsearch.common.bytes.BytesReference;
@ -100,7 +99,6 @@ public class DeleteByQueryRequest extends IndicesReplicationOperationRequest<Del
*
* @see org.elasticsearch.index.query.QueryBuilders
*/
@Required
public DeleteByQueryRequest query(QueryBuilder queryBuilder) {
this.querySource = queryBuilder.buildAsBytes();
this.querySourceUnsafe = false;
@ -111,7 +109,6 @@ public class DeleteByQueryRequest extends IndicesReplicationOperationRequest<Del
* The query source to execute. It is preferable to use either {@link #query(byte[])}
* or {@link #query(org.elasticsearch.index.query.QueryBuilder)}.
*/
@Required
public DeleteByQueryRequest query(String querySource) {
this.querySource = new BytesArray(querySource.getBytes(Charsets.UTF_8));
this.querySourceUnsafe = false;
@ -121,7 +118,6 @@ public class DeleteByQueryRequest extends IndicesReplicationOperationRequest<Del
/**
* The query source to execute in the form of a map.
*/
@Required
public DeleteByQueryRequest query(Map querySource) {
try {
XContentBuilder builder = XContentFactory.contentBuilder(contentType);
@ -132,7 +128,6 @@ public class DeleteByQueryRequest extends IndicesReplicationOperationRequest<Del
}
}
@Required
public DeleteByQueryRequest query(XContentBuilder builder) {
this.querySource = builder.bytes();
this.querySourceUnsafe = false;
@ -142,7 +137,6 @@ public class DeleteByQueryRequest extends IndicesReplicationOperationRequest<Del
/**
* The query source to execute.
*/
@Required
public DeleteByQueryRequest query(byte[] querySource) {
return query(querySource, 0, querySource.length, false);
}
@ -150,7 +144,6 @@ public class DeleteByQueryRequest extends IndicesReplicationOperationRequest<Del
/**
* The query source to execute.
*/
@Required
public DeleteByQueryRequest query(byte[] querySource, int offset, int length, boolean unsafe) {
this.querySource = new BytesArray(querySource, offset, length);
this.querySourceUnsafe = unsafe;

View File

@ -23,7 +23,6 @@ import org.elasticsearch.action.ActionRequestValidationException;
import org.elasticsearch.action.ValidateActions;
import org.elasticsearch.action.support.single.shard.SingleShardOperationRequest;
import org.elasticsearch.common.Nullable;
import org.elasticsearch.common.Required;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.lucene.uid.Versions;
@ -113,7 +112,6 @@ public class GetRequest extends SingleShardOperationRequest<GetRequest> {
/**
* Sets the id of the document to fetch.
*/
@Required
public GetRequest id(String id) {
this.id = id;
return this;

View File

@ -31,7 +31,6 @@ import org.elasticsearch.client.Requests;
import org.elasticsearch.cluster.metadata.MappingMetaData;
import org.elasticsearch.cluster.metadata.MetaData;
import org.elasticsearch.common.Nullable;
import org.elasticsearch.common.Required;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.bytes.BytesArray;
import org.elasticsearch.common.bytes.BytesReference;
@ -208,7 +207,6 @@ public class IndexRequest extends ShardReplicationOperationRequest<IndexRequest>
/**
* Sets the type of the indexed document.
*/
@Required
public IndexRequest type(String type) {
this.type = type;
return this;
@ -322,7 +320,6 @@ public class IndexRequest extends ShardReplicationOperationRequest<IndexRequest>
*
* @param source The map to index
*/
@Required
public IndexRequest source(Map source) throws ElasticSearchGenerationException {
return source(source, contentType);
}
@ -332,7 +329,6 @@ public class IndexRequest extends ShardReplicationOperationRequest<IndexRequest>
*
* @param source The map to index
*/
@Required
public IndexRequest source(Map source, XContentType contentType) throws ElasticSearchGenerationException {
try {
XContentBuilder builder = XContentFactory.contentBuilder(contentType);
@ -349,7 +345,6 @@ public class IndexRequest extends ShardReplicationOperationRequest<IndexRequest>
* <p>Note, its preferable to either set it using {@link #source(org.elasticsearch.common.xcontent.XContentBuilder)}
* or using the {@link #source(byte[])}.
*/
@Required
public IndexRequest source(String source) {
this.source = new BytesArray(source.getBytes(Charsets.UTF_8));
this.sourceUnsafe = false;
@ -359,14 +354,12 @@ public class IndexRequest extends ShardReplicationOperationRequest<IndexRequest>
/**
* Sets the content source to index.
*/
@Required
public IndexRequest source(XContentBuilder sourceBuilder) {
source = sourceBuilder.bytes();
sourceUnsafe = false;
return this;
}
@Required
public IndexRequest source(String field1, Object value1) {
try {
XContentBuilder builder = XContentFactory.contentBuilder(contentType);
@ -377,7 +370,6 @@ public class IndexRequest extends ShardReplicationOperationRequest<IndexRequest>
}
}
@Required
public IndexRequest source(String field1, Object value1, String field2, Object value2) {
try {
XContentBuilder builder = XContentFactory.contentBuilder(contentType);
@ -388,7 +380,6 @@ public class IndexRequest extends ShardReplicationOperationRequest<IndexRequest>
}
}
@Required
public IndexRequest source(String field1, Object value1, String field2, Object value2, String field3, Object value3) {
try {
XContentBuilder builder = XContentFactory.contentBuilder(contentType);
@ -399,7 +390,6 @@ public class IndexRequest extends ShardReplicationOperationRequest<IndexRequest>
}
}
@Required
public IndexRequest source(String field1, Object value1, String field2, Object value2, String field3, Object value3, String field4, Object value4) {
try {
XContentBuilder builder = XContentFactory.contentBuilder(contentType);
@ -410,7 +400,6 @@ public class IndexRequest extends ShardReplicationOperationRequest<IndexRequest>
}
}
@Required
public IndexRequest source(Object... source) {
try {
XContentBuilder builder = XContentFactory.contentBuilder(contentType);
@ -449,7 +438,6 @@ public class IndexRequest extends ShardReplicationOperationRequest<IndexRequest>
* @param offset The offset in the byte array
* @param length The length of the data
*/
@Required
public IndexRequest source(byte[] source, int offset, int length) {
return source(source, offset, length, false);
}
@ -462,7 +450,6 @@ public class IndexRequest extends ShardReplicationOperationRequest<IndexRequest>
* @param length The length of the data
* @param unsafe Is the byte array safe to be used form a different thread
*/
@Required
public IndexRequest source(byte[] source, int offset, int length, boolean unsafe) {
this.source = new BytesArray(source, offset, length);
this.sourceUnsafe = unsafe;

View File

@ -27,7 +27,6 @@ import org.elasticsearch.action.ActionRequestValidationException;
import org.elasticsearch.action.ValidateActions;
import org.elasticsearch.action.search.SearchType;
import org.elasticsearch.client.Requests;
import org.elasticsearch.common.Required;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.bytes.BytesArray;
import org.elasticsearch.common.bytes.BytesReference;
@ -121,7 +120,6 @@ public class MoreLikeThisRequest extends ActionRequest<MoreLikeThisRequest> {
/**
* The type of document to load from which the "like" query will execute with.
*/
@Required
public MoreLikeThisRequest type(String type) {
this.type = type;
return this;
@ -137,7 +135,6 @@ public class MoreLikeThisRequest extends ActionRequest<MoreLikeThisRequest> {
/**
* The id of document to load from which the "like" query will execute with.
*/
@Required
public MoreLikeThisRequest id(String id) {
this.id = id;
return this;

View File

@ -1,35 +0,0 @@
/*
* Licensed to ElasticSearch and Shay Banon under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. ElasticSearch licenses this
* file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.elasticsearch.common;
import java.lang.annotation.*;
/**
* The presence of this annotation on a method parameter indicates that
* {@code null} is an acceptable value for that parameter. It should not be
* used for parameters of primitive types.
*
*
*/
@Documented
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.METHOD, ElementType.PARAMETER, ElementType.FIELD})
public @interface Required {
}