Skip to content

Commit d86bcd1

Browse files
committed
Rename ParameterMap to DeprecationMap (#37317)
Mechanical change to rename ParameterMap to DeprecationMap as this seems more appropriate for an extended Map to issue deprecation warnings.
1 parent 633aac1 commit d86bcd1

File tree

7 files changed

+28
-28
lines changed

7 files changed

+28
-28
lines changed

server/src/main/java/org/elasticsearch/script/ParameterMap.java renamed to server/src/main/java/org/elasticsearch/script/DeprecationMap.java

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -26,38 +26,38 @@
2626
import java.util.Map;
2727
import java.util.Set;
2828

29-
public final class ParameterMap implements Map<String, Object> {
29+
public final class DeprecationMap implements Map<String, Object> {
3030

3131
private static final DeprecationLogger DEPRECATION_LOGGER =
32-
new DeprecationLogger(LogManager.getLogger(ParameterMap.class));
32+
new DeprecationLogger(LogManager.getLogger(DeprecationMap.class));
3333

34-
private final Map<String, Object> params;
34+
private final Map<String, Object> delegate;
3535

3636
private final Map<String, String> deprecations;
3737

38-
public ParameterMap(Map<String, Object> params, Map<String, String> deprecations) {
39-
this.params = params;
38+
public DeprecationMap(Map<String, Object> delegate, Map<String, String> deprecations) {
39+
this.delegate = delegate;
4040
this.deprecations = deprecations;
4141
}
4242

4343
@Override
4444
public int size() {
45-
return params.size();
45+
return delegate.size();
4646
}
4747

4848
@Override
4949
public boolean isEmpty() {
50-
return params.isEmpty();
50+
return delegate.isEmpty();
5151
}
5252

5353
@Override
5454
public boolean containsKey(final Object key) {
55-
return params.containsKey(key);
55+
return delegate.containsKey(key);
5656
}
5757

5858
@Override
5959
public boolean containsValue(final Object value) {
60-
return params.containsValue(value);
60+
return delegate.containsValue(value);
6161
}
6262

6363
@Override
@@ -66,41 +66,41 @@ public Object get(final Object key) {
6666
if (deprecationMessage != null) {
6767
DEPRECATION_LOGGER.deprecated(deprecationMessage);
6868
}
69-
return params.get(key);
69+
return delegate.get(key);
7070
}
7171

7272
@Override
7373
public Object put(final String key, final Object value) {
74-
return params.put(key, value);
74+
return delegate.put(key, value);
7575
}
7676

7777
@Override
7878
public Object remove(final Object key) {
79-
return params.remove(key);
79+
return delegate.remove(key);
8080
}
8181

8282
@Override
8383
public void putAll(final Map<? extends String, ?> m) {
84-
params.putAll(m);
84+
delegate.putAll(m);
8585
}
8686

8787
@Override
8888
public void clear() {
89-
params.clear();
89+
delegate.clear();
9090
}
9191

9292
@Override
9393
public Set<String> keySet() {
94-
return params.keySet();
94+
return delegate.keySet();
9595
}
9696

9797
@Override
9898
public Collection<Object> values() {
99-
return params.values();
99+
return delegate.values();
100100
}
101101

102102
@Override
103103
public Set<Entry<String, Object>> entrySet() {
104-
return params.entrySet();
104+
return delegate.entrySet();
105105
}
106106
}

server/src/main/java/org/elasticsearch/script/ScoreScript.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public ScoreScript(Map<String, Object> params, SearchLookup lookup, LeafReaderCo
7373
this.leafLookup = lookup.getLeafSearchLookup(leafContext);
7474
params = new HashMap<>(params);
7575
params.putAll(leafLookup.asMap());
76-
this.params = new ParameterMap(params, DEPRECATIONS);
76+
this.params = new DeprecationMap(params, DEPRECATIONS);
7777
}
7878
}
7979

server/src/main/java/org/elasticsearch/script/ScriptedMetricAggContexts.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public abstract static class InitScript {
5050
private final Object state;
5151

5252
public InitScript(Map<String, Object> params, Object state) {
53-
this.params = new ParameterMap(params, DEPRECATIONS);
53+
this.params = new DeprecationMap(params, DEPRECATIONS);
5454
this.state = state;
5555
}
5656

@@ -106,7 +106,7 @@ public MapScript(Map<String, Object> params, Object state, SearchLookup lookup,
106106
if (leafLookup != null) {
107107
params = new HashMap<>(params); // copy params so we aren't modifying input
108108
params.putAll(leafLookup.asMap()); // add lookup vars
109-
params = new ParameterMap(params, DEPRECATIONS); // wrap with deprecations
109+
params = new DeprecationMap(params, DEPRECATIONS); // wrap with deprecations
110110
}
111111
this.params = params;
112112
}
@@ -178,7 +178,7 @@ public abstract static class CombineScript {
178178
private final Object state;
179179

180180
public CombineScript(Map<String, Object> params, Object state) {
181-
this.params = new ParameterMap(params, DEPRECATIONS);
181+
this.params = new DeprecationMap(params, DEPRECATIONS);
182182
this.state = state;
183183
}
184184

@@ -216,7 +216,7 @@ public abstract static class ReduceScript {
216216
private final List<Object> states;
217217

218218
public ReduceScript(Map<String, Object> params, List<Object> states) {
219-
this.params = new ParameterMap(params, DEPRECATIONS);
219+
this.params = new DeprecationMap(params, DEPRECATIONS);
220220
this.states = states;
221221
}
222222

server/src/main/java/org/elasticsearch/script/TermsSetQueryScript.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public abstract class TermsSetQueryScript {
6161
private final LeafSearchLookup leafLookup;
6262

6363
public TermsSetQueryScript(Map<String, Object> params, SearchLookup lookup, LeafReaderContext leafContext) {
64-
this.params = new ParameterMap(params, DEPRECATIONS);
64+
this.params = new DeprecationMap(params, DEPRECATIONS);
6565
this.leafLookup = lookup.getLeafSearchLookup(leafContext);
6666
}
6767

server/src/main/java/org/elasticsearch/script/UpdateScript.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public abstract class UpdateScript {
5454
public UpdateScript(Map<String, Object> params, Map<String, Object> ctx) {
5555
Map<String, Object> paramsWithCtx = new HashMap<>(params);
5656
paramsWithCtx.put("ctx", ctx);
57-
this.params = new ParameterMap(paramsWithCtx, DEPRECATIONS);
57+
this.params = new DeprecationMap(paramsWithCtx, DEPRECATIONS);
5858
this.ctx = ctx;
5959
}
6060

x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/condition/WatcherConditionScript.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*/
66
package org.elasticsearch.xpack.watcher.condition;
77

8-
import org.elasticsearch.script.ParameterMap;
8+
import org.elasticsearch.script.DeprecationMap;
99
import org.elasticsearch.script.ScriptContext;
1010
import org.elasticsearch.xpack.core.watcher.execution.WatchExecutionContext;
1111
import org.elasticsearch.xpack.watcher.support.Variables;
@@ -40,7 +40,7 @@ public WatcherConditionScript(Map<String, Object> params, WatchExecutionContext
4040
Map<String, Object> paramsWithCtx = new HashMap<>(params);
4141
Map<String, Object> ctx = Variables.createCtx(watcherContext, watcherContext.payload());
4242
paramsWithCtx.put("ctx", ctx);
43-
this.params = new ParameterMap(Collections.unmodifiableMap(paramsWithCtx), DEPRECATIONS);
43+
this.params = new DeprecationMap(Collections.unmodifiableMap(paramsWithCtx), DEPRECATIONS);
4444
this.ctx = ctx;
4545
}
4646

x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/transform/script/WatcherTransformScript.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*/
66
package org.elasticsearch.xpack.watcher.transform.script;
77

8-
import org.elasticsearch.script.ParameterMap;
8+
import org.elasticsearch.script.DeprecationMap;
99
import org.elasticsearch.script.ScriptContext;
1010
import org.elasticsearch.xpack.core.watcher.execution.WatchExecutionContext;
1111
import org.elasticsearch.xpack.core.watcher.watch.Payload;
@@ -41,7 +41,7 @@ public WatcherTransformScript(Map<String, Object> params, WatchExecutionContext
4141
Map<String, Object> paramsWithCtx = new HashMap<>(params);
4242
Map<String, Object> ctx = Variables.createCtx(watcherContext, payload);
4343
paramsWithCtx.put("ctx", ctx);
44-
this.params = new ParameterMap(Collections.unmodifiableMap(paramsWithCtx), DEPRECATIONS);
44+
this.params = new DeprecationMap(Collections.unmodifiableMap(paramsWithCtx), DEPRECATIONS);
4545
this.ctx = ctx;
4646
}
4747

0 commit comments

Comments
 (0)