diff --git a/server/src/main/java/org/elasticsearch/script/AbstractSortScript.java b/server/src/main/java/org/elasticsearch/script/AbstractSortScript.java index 1d8de9f95f4..949ca5bdb7f 100644 --- a/server/src/main/java/org/elasticsearch/script/AbstractSortScript.java +++ b/server/src/main/java/org/elasticsearch/script/AbstractSortScript.java @@ -66,7 +66,7 @@ abstract class AbstractSortScript implements ScorerAware { this.leafLookup = lookup.getLeafSearchLookup(leafContext); Map parameters = new HashMap<>(params); parameters.putAll(leafLookup.asMap()); - this.params = new ParameterMap(parameters, DEPRECATIONS); + this.params = new DeprecationMap(parameters, DEPRECATIONS); } protected AbstractSortScript() { diff --git a/server/src/main/java/org/elasticsearch/script/AggregationScript.java b/server/src/main/java/org/elasticsearch/script/AggregationScript.java index 8e1b4858166..5d36b91785f 100644 --- a/server/src/main/java/org/elasticsearch/script/AggregationScript.java +++ b/server/src/main/java/org/elasticsearch/script/AggregationScript.java @@ -71,7 +71,7 @@ public abstract class AggregationScript implements ScorerAware { private Object value; public AggregationScript(Map params, SearchLookup lookup, LeafReaderContext leafContext) { - this.params = new ParameterMap(new HashMap<>(params), DEPRECATIONS); + this.params = new DeprecationMap(new HashMap<>(params), DEPRECATIONS); this.leafLookup = lookup.getLeafSearchLookup(leafContext); this.params.putAll(leafLookup.asMap()); } diff --git a/server/src/main/java/org/elasticsearch/script/ParameterMap.java b/server/src/main/java/org/elasticsearch/script/DeprecationMap.java similarity index 74% rename from server/src/main/java/org/elasticsearch/script/ParameterMap.java rename to server/src/main/java/org/elasticsearch/script/DeprecationMap.java index b40c0f9b401..5b14e2e3b11 100644 --- a/server/src/main/java/org/elasticsearch/script/ParameterMap.java +++ b/server/src/main/java/org/elasticsearch/script/DeprecationMap.java @@ -26,38 +26,38 @@ import java.util.Collection; import java.util.Map; import java.util.Set; -public final class ParameterMap implements Map { +public final class DeprecationMap implements Map { private static final DeprecationLogger deprecationLogger = - new DeprecationLogger(LogManager.getLogger(ParameterMap.class)); + new DeprecationLogger(LogManager.getLogger(DeprecationMap.class)); - private final Map params; + private final Map delegate; private final Map deprecations; - public ParameterMap(Map params, Map deprecations) { - this.params = params; + public DeprecationMap(Map delegate, Map deprecations) { + this.delegate = delegate; this.deprecations = deprecations; } @Override public int size() { - return params.size(); + return delegate.size(); } @Override public boolean isEmpty() { - return params.isEmpty(); + return delegate.isEmpty(); } @Override public boolean containsKey(final Object key) { - return params.containsKey(key); + return delegate.containsKey(key); } @Override public boolean containsValue(final Object value) { - return params.containsValue(value); + return delegate.containsValue(value); } @Override @@ -66,41 +66,41 @@ public final class ParameterMap implements Map { if (deprecationMessage != null) { deprecationLogger.deprecated(deprecationMessage); } - return params.get(key); + return delegate.get(key); } @Override public Object put(final String key, final Object value) { - return params.put(key, value); + return delegate.put(key, value); } @Override public Object remove(final Object key) { - return params.remove(key); + return delegate.remove(key); } @Override public void putAll(final Map m) { - params.putAll(m); + delegate.putAll(m); } @Override public void clear() { - params.clear(); + delegate.clear(); } @Override public Set keySet() { - return params.keySet(); + return delegate.keySet(); } @Override public Collection values() { - return params.values(); + return delegate.values(); } @Override public Set> entrySet() { - return params.entrySet(); + return delegate.entrySet(); } } diff --git a/server/src/main/java/org/elasticsearch/script/FieldScript.java b/server/src/main/java/org/elasticsearch/script/FieldScript.java index 29684a64477..4f0e3c72290 100644 --- a/server/src/main/java/org/elasticsearch/script/FieldScript.java +++ b/server/src/main/java/org/elasticsearch/script/FieldScript.java @@ -63,7 +63,7 @@ public abstract class FieldScript { this.leafLookup = lookup.getLeafSearchLookup(leafContext); params = new HashMap<>(params); params.putAll(leafLookup.asMap()); - this.params = new ParameterMap(params, DEPRECATIONS); + this.params = new DeprecationMap(params, DEPRECATIONS); } // for expression engine diff --git a/server/src/main/java/org/elasticsearch/script/ScoreScript.java b/server/src/main/java/org/elasticsearch/script/ScoreScript.java index c88c68fd407..78d206888e9 100644 --- a/server/src/main/java/org/elasticsearch/script/ScoreScript.java +++ b/server/src/main/java/org/elasticsearch/script/ScoreScript.java @@ -73,7 +73,7 @@ public abstract class ScoreScript { this.leafLookup = lookup.getLeafSearchLookup(leafContext); params = new HashMap<>(params); params.putAll(leafLookup.asMap()); - this.params = new ParameterMap(params, DEPRECATIONS); + this.params = new DeprecationMap(params, DEPRECATIONS); } } diff --git a/server/src/main/java/org/elasticsearch/script/ScriptedMetricAggContexts.java b/server/src/main/java/org/elasticsearch/script/ScriptedMetricAggContexts.java index 4c51b9fed69..a17503a026f 100644 --- a/server/src/main/java/org/elasticsearch/script/ScriptedMetricAggContexts.java +++ b/server/src/main/java/org/elasticsearch/script/ScriptedMetricAggContexts.java @@ -95,7 +95,7 @@ public class ScriptedMetricAggContexts { if (leafLookup != null) { params = new HashMap<>(params); // copy params so we aren't modifying input params.putAll(leafLookup.asMap()); // add lookup vars - params = new ParameterMap(params, DEPRECATIONS); // wrap with deprecations + params = new DeprecationMap(params, DEPRECATIONS); // wrap with deprecations } this.params = params; } diff --git a/server/src/main/java/org/elasticsearch/script/TermsSetQueryScript.java b/server/src/main/java/org/elasticsearch/script/TermsSetQueryScript.java index 122e3defe75..9462b6a8e81 100644 --- a/server/src/main/java/org/elasticsearch/script/TermsSetQueryScript.java +++ b/server/src/main/java/org/elasticsearch/script/TermsSetQueryScript.java @@ -64,7 +64,7 @@ public abstract class TermsSetQueryScript { Map parameters = new HashMap<>(params); this.leafLookup = lookup.getLeafSearchLookup(leafContext); parameters.putAll(leafLookup.asMap()); - this.params = new ParameterMap(parameters, DEPRECATIONS); + this.params = new DeprecationMap(parameters, DEPRECATIONS); } protected TermsSetQueryScript() {