mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-03-24 17:09:48 +00:00
make every static field final (immutable)
This commit is contained in:
parent
6b672e29f5
commit
fd593acafe
@ -49,9 +49,9 @@ public class CustomFieldQuery extends FieldQuery {
|
||||
}
|
||||
|
||||
// hack since flatten is called from the parent constructor, so we can't pass it
|
||||
public static ThreadLocal<IndexReader> reader = new ThreadLocal<IndexReader>();
|
||||
public static final ThreadLocal<IndexReader> reader = new ThreadLocal<IndexReader>();
|
||||
|
||||
public static ThreadLocal<Boolean> highlightFilters = new ThreadLocal<Boolean>();
|
||||
public static final ThreadLocal<Boolean> highlightFilters = new ThreadLocal<Boolean>();
|
||||
|
||||
public CustomFieldQuery(Query query, FastVectorHighlighter highlighter) {
|
||||
this(query, highlighter.isPhraseHighlight(), highlighter.isFieldMatch());
|
||||
|
@ -26,9 +26,9 @@ import org.elasticsearch.common.collect.Tuple;
|
||||
*/
|
||||
public class ParsedScrollId {
|
||||
|
||||
public static String QUERY_THEN_FETCH_TYPE = "queryThenFetch";
|
||||
public static final String QUERY_THEN_FETCH_TYPE = "queryThenFetch";
|
||||
|
||||
public static String QUERY_AND_FETCH_TYPE = "queryAndFetch";
|
||||
public static final String QUERY_AND_FETCH_TYPE = "queryAndFetch";
|
||||
|
||||
private final String source;
|
||||
|
||||
|
@ -63,12 +63,12 @@ public class Requests {
|
||||
/**
|
||||
* The content type used to generate request builders (query / search).
|
||||
*/
|
||||
public static XContentType CONTENT_TYPE = XContentType.SMILE;
|
||||
public final static XContentType CONTENT_TYPE = XContentType.SMILE;
|
||||
|
||||
/**
|
||||
* The default content type to use to generate source documents when indexing.
|
||||
*/
|
||||
public static XContentType INDEX_CONTENT_TYPE = XContentType.JSON;
|
||||
public final static XContentType INDEX_CONTENT_TYPE = XContentType.JSON;
|
||||
|
||||
public static IndexRequest indexRequest() {
|
||||
return new IndexRequest();
|
||||
|
@ -29,8 +29,8 @@ public enum ClusterBlockLevel {
|
||||
WRITE(1),
|
||||
METADATA(2);
|
||||
|
||||
public static ClusterBlockLevel[] ALL = new ClusterBlockLevel[]{READ, WRITE, METADATA};
|
||||
public static ClusterBlockLevel[] READ_WRITE = new ClusterBlockLevel[]{READ, WRITE};
|
||||
public static final ClusterBlockLevel[] ALL = new ClusterBlockLevel[]{READ, WRITE, METADATA};
|
||||
public static final ClusterBlockLevel[] READ_WRITE = new ClusterBlockLevel[]{READ, WRITE};
|
||||
|
||||
private final int id;
|
||||
|
||||
|
@ -40,7 +40,7 @@ import static org.elasticsearch.common.collect.Sets.*;
|
||||
@Immutable
|
||||
public class MetaData implements Iterable<IndexMetaData> {
|
||||
|
||||
public static MetaData EMPTY_META_DATA = newMetaDataBuilder().build();
|
||||
public static final MetaData EMPTY_META_DATA = newMetaDataBuilder().build();
|
||||
|
||||
private final ImmutableMap<String, IndexMetaData> indices;
|
||||
private final ImmutableMap<String, IndexTemplateMetaData> templates;
|
||||
|
@ -41,7 +41,7 @@ import static org.elasticsearch.common.collect.Maps.*;
|
||||
*/
|
||||
public class DiscoveryNodes implements Iterable<DiscoveryNode> {
|
||||
|
||||
public static DiscoveryNodes EMPTY_NODES = newNodesBuilder().build();
|
||||
public static final DiscoveryNodes EMPTY_NODES = newNodesBuilder().build();
|
||||
|
||||
private final ImmutableMap<String, DiscoveryNode> nodes;
|
||||
|
||||
|
@ -26,7 +26,7 @@ import org.elasticsearch.common.thread.ThreadLocals;
|
||||
*/
|
||||
public class Bytes {
|
||||
|
||||
public static ThreadLocal<ThreadLocals.CleanableValue<byte[]>> cachedBytes = new ThreadLocal<ThreadLocals.CleanableValue<byte[]>>() {
|
||||
public static final ThreadLocal<ThreadLocals.CleanableValue<byte[]>> cachedBytes = new ThreadLocal<ThreadLocals.CleanableValue<byte[]>>() {
|
||||
@Override protected ThreadLocals.CleanableValue<byte[]> initialValue() {
|
||||
return new ThreadLocals.CleanableValue<byte[]>(new byte[1024]);
|
||||
}
|
||||
|
@ -73,7 +73,7 @@ public class LZFEncoder {
|
||||
} while (left > 0);
|
||||
}
|
||||
|
||||
public static ThreadLocal<ThreadLocals.CleanableValue<ChunkEncoder>> cachedEncoder = new ThreadLocal<ThreadLocals.CleanableValue<ChunkEncoder>>() {
|
||||
public static final ThreadLocal<ThreadLocals.CleanableValue<ChunkEncoder>> cachedEncoder = new ThreadLocal<ThreadLocals.CleanableValue<ChunkEncoder>>() {
|
||||
@Override protected ThreadLocals.CleanableValue<ChunkEncoder> initialValue() {
|
||||
return new ThreadLocals.CleanableValue<ChunkEncoder>(new ChunkEncoder(LZFChunk.MAX_CHUNK_LEN));
|
||||
}
|
||||
|
@ -4,7 +4,7 @@ import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
public class LZFInputStream extends InputStream {
|
||||
public static int EOF_FLAG = -1;
|
||||
public static final int EOF_FLAG = -1;
|
||||
|
||||
/* stream to be decompressed */
|
||||
private final InputStream inputStream;
|
||||
|
@ -29,7 +29,7 @@ import java.io.IOException;
|
||||
* @author kimchy (shay.banon)
|
||||
*/
|
||||
public class LZFStreamInput extends StreamInput {
|
||||
public static int EOF_FLAG = -1;
|
||||
public static final int EOF_FLAG = -1;
|
||||
|
||||
/* the current buffer of compressed bytes */
|
||||
private final byte[] compressedBytes = new byte[LZFChunk.MAX_CHUNK_LEN];
|
||||
|
@ -44,9 +44,9 @@ import java.util.Map;
|
||||
*/
|
||||
public class Lucene {
|
||||
|
||||
@SuppressWarnings({"deprecation"}) public static Version VERSION = Version.LUCENE_CURRENT;
|
||||
public static Version ANALYZER_VERSION = VERSION;
|
||||
public static Version QUERYPARSER_VERSION = VERSION;
|
||||
@SuppressWarnings({"deprecation"}) public static final Version VERSION = Version.LUCENE_CURRENT;
|
||||
public static final Version ANALYZER_VERSION = VERSION;
|
||||
public static final Version QUERYPARSER_VERSION = VERSION;
|
||||
|
||||
public static final NamedAnalyzer STANDARD_ANALYZER = new NamedAnalyzer("_standard", AnalyzerScope.GLOBAL, new StandardAnalyzer(ANALYZER_VERSION));
|
||||
public static final NamedAnalyzer KEYWORD_ANALYZER = new NamedAnalyzer("_keyword", AnalyzerScope.GLOBAL, new KeywordAnalyzer());
|
||||
|
@ -29,7 +29,7 @@ import java.io.IOException;
|
||||
*/
|
||||
public abstract class DocSet extends DocIdSet {
|
||||
|
||||
public static DocSet EMPTY_DOC_SET = new DocSet() {
|
||||
public static final DocSet EMPTY_DOC_SET = new DocSet() {
|
||||
@Override public boolean get(int doc) throws IOException {
|
||||
return false;
|
||||
}
|
||||
|
@ -57,9 +57,9 @@ public class NetworkService extends AbstractComponent {
|
||||
public static final String TCP_BLOCKING_CLIENT = "network.tcp.blocking_client";
|
||||
public static final String TCP_CONNECT_TIMEOUT = "network.tcp.connect_timeout";
|
||||
|
||||
public static ByteSizeValue TCP_DEFAULT_SEND_BUFFER_SIZE = new ByteSizeValue(32, ByteSizeUnit.KB);
|
||||
public static ByteSizeValue TCP_DEFAULT_RECEIVE_BUFFER_SIZE = new ByteSizeValue(32, ByteSizeUnit.KB);
|
||||
public static TimeValue TCP_DEFAULT_CONNECT_TIMEOUT = new TimeValue(30, TimeUnit.SECONDS);
|
||||
public static final ByteSizeValue TCP_DEFAULT_SEND_BUFFER_SIZE = new ByteSizeValue(32, ByteSizeUnit.KB);
|
||||
public static final ByteSizeValue TCP_DEFAULT_RECEIVE_BUFFER_SIZE = new ByteSizeValue(32, ByteSizeUnit.KB);
|
||||
public static final TimeValue TCP_DEFAULT_CONNECT_TIMEOUT = new TimeValue(30, TimeUnit.SECONDS);
|
||||
}
|
||||
|
||||
public static interface CustomNameResolver {
|
||||
|
@ -30,7 +30,7 @@ import java.util.List;
|
||||
*/
|
||||
public class CommitPoint {
|
||||
|
||||
public static CommitPoint NULL = new CommitPoint(-1, "_null_", Type.GENERATED, ImmutableList.<CommitPoint.FileInfo>of(), ImmutableList.<CommitPoint.FileInfo>of());
|
||||
public static final CommitPoint NULL = new CommitPoint(-1, "_null_", Type.GENERATED, ImmutableList.<CommitPoint.FileInfo>of(), ImmutableList.<CommitPoint.FileInfo>of());
|
||||
|
||||
public static class FileInfo {
|
||||
private final String name;
|
||||
|
@ -29,7 +29,7 @@ import org.apache.lucene.document.FieldSelectorResult;
|
||||
*/
|
||||
public class AllButSourceFieldSelector implements FieldSelector {
|
||||
|
||||
public static AllButSourceFieldSelector INSTANCE = new AllButSourceFieldSelector();
|
||||
public static final AllButSourceFieldSelector INSTANCE = new AllButSourceFieldSelector();
|
||||
|
||||
@Override public FieldSelectorResult accept(String fieldName) {
|
||||
if (SourceFieldMapper.NAME.equals(fieldName)) {
|
||||
|
@ -29,7 +29,7 @@ import org.apache.lucene.document.FieldSelectorResult;
|
||||
*/
|
||||
public class SourceFieldSelector implements FieldSelector {
|
||||
|
||||
public static SourceFieldSelector INSTANCE = new SourceFieldSelector();
|
||||
public static final SourceFieldSelector INSTANCE = new SourceFieldSelector();
|
||||
|
||||
private SourceFieldSelector() {
|
||||
|
||||
|
@ -29,7 +29,7 @@ import org.apache.lucene.document.FieldSelectorResult;
|
||||
*/
|
||||
public class UidFieldSelector implements FieldSelector {
|
||||
|
||||
public static UidFieldSelector INSTANCE = new UidFieldSelector();
|
||||
public static final UidFieldSelector INSTANCE = new UidFieldSelector();
|
||||
|
||||
private UidFieldSelector() {
|
||||
|
||||
|
@ -40,7 +40,7 @@ import static java.lang.annotation.RetentionPolicy.*;
|
||||
public @interface RiverIndexName {
|
||||
|
||||
static class Conf {
|
||||
public static String DEFAULT_INDEX_NAME = "_river";
|
||||
public static final String DEFAULT_INDEX_NAME = "_river";
|
||||
|
||||
public static String indexName(Settings settings) {
|
||||
return settings.get("river.index_name", DEFAULT_INDEX_NAME);
|
||||
|
@ -45,7 +45,7 @@ public class SourceSimpleFragmentsBuilder extends SimpleFragmentsBuilder {
|
||||
this.searchContext = searchContext;
|
||||
}
|
||||
|
||||
public static Field[] EMPTY_FIELDS = new Field[0];
|
||||
public static final Field[] EMPTY_FIELDS = new Field[0];
|
||||
|
||||
@Override protected Field[] getFields(IndexReader reader, int docId, String fieldName) throws IOException {
|
||||
// we know its low level reader, and matching docId, since that's how we call the highlighter with
|
||||
|
@ -26,7 +26,7 @@ import org.elasticsearch.common.unit.TimeValue;
|
||||
*/
|
||||
public class TransportRequestOptions {
|
||||
|
||||
public static TransportRequestOptions EMPTY = options();
|
||||
public static final TransportRequestOptions EMPTY = options();
|
||||
|
||||
public static TransportRequestOptions options() {
|
||||
return new TransportRequestOptions();
|
||||
|
Loading…
x
Reference in New Issue
Block a user