From e6f873c620de1b95bc44ee111a581f6ebecd2b45 Mon Sep 17 00:00:00 2001 From: Yannick Welsch Date: Tue, 6 Feb 2018 18:00:14 +0100 Subject: [PATCH] Remove feature parsing for GetIndicesAction (#28535) Removes dead code. Follow-up of #24723 --- .../admin/indices/get/GetIndexRequest.java | 38 ++----------------- 1 file changed, 4 insertions(+), 34 deletions(-) diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/get/GetIndexRequest.java b/server/src/main/java/org/elasticsearch/action/admin/indices/get/GetIndexRequest.java index 43beba5b670..477656d96cb 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/get/GetIndexRequest.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/get/GetIndexRequest.java @@ -34,9 +34,9 @@ import java.util.List; */ public class GetIndexRequest extends ClusterInfoRequest { public enum Feature { - ALIASES((byte) 0, "_aliases", "_alias"), - MAPPINGS((byte) 1, "_mappings", "_mapping"), - SETTINGS((byte) 2, "_settings"); + ALIASES((byte) 0), + MAPPINGS((byte) 1), + SETTINGS((byte) 2); private static final Feature[] FEATURES = new Feature[Feature.values().length]; @@ -47,52 +47,22 @@ public class GetIndexRequest extends ClusterInfoRequest { } } - private final List validNames; - private final String preferredName; private final byte id; - Feature(byte id, String... validNames) { - assert validNames != null && validNames.length > 0; + Feature(byte id) { this.id = id; - this.validNames = Arrays.asList(validNames); - this.preferredName = validNames[0]; } public byte id() { return id; } - public String preferredName() { - return preferredName; - } - - public boolean validName(String name) { - return this.validNames.contains(name); - } - - public static Feature fromName(String name) { - for (Feature feature : Feature.values()) { - if (feature.validName(name)) { - return feature; - } - } - throw new IllegalArgumentException("No endpoint or operation is available at [" + name + "]"); - } - public static Feature fromId(byte id) { if (id < 0 || id >= FEATURES.length) { throw new IllegalArgumentException("No mapping for id [" + id + "]"); } return FEATURES[id]; } - - public static Feature[] convertToFeatures(String... featureNames) { - Feature[] features = new Feature[featureNames.length]; - for (int i = 0; i < featureNames.length; i++) { - features[i] = Feature.fromName(featureNames[i]); - } - return features; - } } private static final Feature[] DEFAULT_FEATURES = new Feature[] { Feature.ALIASES, Feature.MAPPINGS, Feature.SETTINGS };