diff --git a/core/src/main/java/org/elasticsearch/cluster/ClusterState.java b/core/src/main/java/org/elasticsearch/cluster/ClusterState.java index 7699e6fff87c8..c842c57daec50 100644 --- a/core/src/main/java/org/elasticsearch/cluster/ClusterState.java +++ b/core/src/main/java/org/elasticsearch/cluster/ClusterState.java @@ -108,13 +108,7 @@ public static void registerPrototype(String type, Custom proto) { registerPrototype(RestoreInProgress.TYPE, RestoreInProgress.PROTO); } - @Nullable public static T lookupPrototype(String type) { - //noinspection unchecked - return (T) customPrototypes.get(type); - } - - public static T lookupPrototypeSafe(String type) { @SuppressWarnings("unchecked") T proto = (T) customPrototypes.get(type); if (proto == null) { @@ -308,7 +302,7 @@ public enum Metric { private final String value; - private Metric(String value) { + Metric(String value) { this.value = value; } @@ -630,10 +624,6 @@ public Builder stateUUID(String uuid) { return this; } - public Custom getCustom(String type) { - return customs.get(type); - } - public Builder putCustom(String type, Custom custom) { customs.put(type, custom); return this; @@ -707,7 +697,7 @@ public ClusterState readFrom(StreamInput in, DiscoveryNode localNode) throws IOE int customSize = in.readVInt(); for (int i = 0; i < customSize; i++) { String type = in.readString(); - Custom customIndexMetaData = lookupPrototypeSafe(type).readFrom(in); + Custom customIndexMetaData = lookupPrototype(type).readFrom(in); builder.putCustom(type, customIndexMetaData); } return builder.build(); @@ -779,12 +769,12 @@ public ClusterStateDiff(StreamInput in, ClusterState proto) throws IOException { new DiffableUtils.DiffableValueSerializer() { @Override public Custom read(StreamInput in, String key) throws IOException { - return lookupPrototypeSafe(key).readFrom(in); + return lookupPrototype(key).readFrom(in); } @Override public Diff readDiff(StreamInput in, String key) throws IOException { - return lookupPrototypeSafe(key).readDiffFrom(in); + return lookupPrototype(key).readDiffFrom(in); } }); }