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.
This commit is contained in:
Jack Conradson 2019-01-10 13:58:00 -08:00 committed by GitHub
parent 434430506b
commit b5b93a2746
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 23 additions and 23 deletions

View File

@ -66,7 +66,7 @@ abstract class AbstractSortScript implements ScorerAware {
this.leafLookup = lookup.getLeafSearchLookup(leafContext); this.leafLookup = lookup.getLeafSearchLookup(leafContext);
Map<String, Object> parameters = new HashMap<>(params); Map<String, Object> parameters = new HashMap<>(params);
parameters.putAll(leafLookup.asMap()); parameters.putAll(leafLookup.asMap());
this.params = new ParameterMap(parameters, DEPRECATIONS); this.params = new DeprecationMap(parameters, DEPRECATIONS);
} }
protected AbstractSortScript() { protected AbstractSortScript() {

View File

@ -71,7 +71,7 @@ public abstract class AggregationScript implements ScorerAware {
private Object value; private Object value;
public AggregationScript(Map<String, Object> params, SearchLookup lookup, LeafReaderContext leafContext) { public AggregationScript(Map<String, Object> 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.leafLookup = lookup.getLeafSearchLookup(leafContext);
this.params.putAll(leafLookup.asMap()); this.params.putAll(leafLookup.asMap());
} }

View File

@ -26,38 +26,38 @@ import java.util.Collection;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
public final class ParameterMap implements Map<String, Object> { public final class DeprecationMap implements Map<String, Object> {
private static final DeprecationLogger deprecationLogger = private static final DeprecationLogger deprecationLogger =
new DeprecationLogger(LogManager.getLogger(ParameterMap.class)); new DeprecationLogger(LogManager.getLogger(DeprecationMap.class));
private final Map<String, Object> params; private final Map<String, Object> delegate;
private final Map<String, String> deprecations; private final Map<String, String> deprecations;
public ParameterMap(Map<String, Object> params, Map<String, String> deprecations) { public DeprecationMap(Map<String, Object> delegate, Map<String, String> deprecations) {
this.params = params; this.delegate = delegate;
this.deprecations = deprecations; this.deprecations = deprecations;
} }
@Override @Override
public int size() { public int size() {
return params.size(); return delegate.size();
} }
@Override @Override
public boolean isEmpty() { public boolean isEmpty() {
return params.isEmpty(); return delegate.isEmpty();
} }
@Override @Override
public boolean containsKey(final Object key) { public boolean containsKey(final Object key) {
return params.containsKey(key); return delegate.containsKey(key);
} }
@Override @Override
public boolean containsValue(final Object value) { public boolean containsValue(final Object value) {
return params.containsValue(value); return delegate.containsValue(value);
} }
@Override @Override
@ -66,41 +66,41 @@ public final class ParameterMap implements Map<String, Object> {
if (deprecationMessage != null) { if (deprecationMessage != null) {
deprecationLogger.deprecated(deprecationMessage); deprecationLogger.deprecated(deprecationMessage);
} }
return params.get(key); return delegate.get(key);
} }
@Override @Override
public Object put(final String key, final Object value) { public Object put(final String key, final Object value) {
return params.put(key, value); return delegate.put(key, value);
} }
@Override @Override
public Object remove(final Object key) { public Object remove(final Object key) {
return params.remove(key); return delegate.remove(key);
} }
@Override @Override
public void putAll(final Map<? extends String, ?> m) { public void putAll(final Map<? extends String, ?> m) {
params.putAll(m); delegate.putAll(m);
} }
@Override @Override
public void clear() { public void clear() {
params.clear(); delegate.clear();
} }
@Override @Override
public Set<String> keySet() { public Set<String> keySet() {
return params.keySet(); return delegate.keySet();
} }
@Override @Override
public Collection<Object> values() { public Collection<Object> values() {
return params.values(); return delegate.values();
} }
@Override @Override
public Set<Entry<String, Object>> entrySet() { public Set<Entry<String, Object>> entrySet() {
return params.entrySet(); return delegate.entrySet();
} }
} }

View File

@ -63,7 +63,7 @@ public abstract class FieldScript {
this.leafLookup = lookup.getLeafSearchLookup(leafContext); this.leafLookup = lookup.getLeafSearchLookup(leafContext);
params = new HashMap<>(params); params = new HashMap<>(params);
params.putAll(leafLookup.asMap()); params.putAll(leafLookup.asMap());
this.params = new ParameterMap(params, DEPRECATIONS); this.params = new DeprecationMap(params, DEPRECATIONS);
} }
// for expression engine // for expression engine

View File

@ -73,7 +73,7 @@ public abstract class ScoreScript {
this.leafLookup = lookup.getLeafSearchLookup(leafContext); this.leafLookup = lookup.getLeafSearchLookup(leafContext);
params = new HashMap<>(params); params = new HashMap<>(params);
params.putAll(leafLookup.asMap()); params.putAll(leafLookup.asMap());
this.params = new ParameterMap(params, DEPRECATIONS); this.params = new DeprecationMap(params, DEPRECATIONS);
} }
} }

View File

@ -95,7 +95,7 @@ public class ScriptedMetricAggContexts {
if (leafLookup != null) { if (leafLookup != null) {
params = new HashMap<>(params); // copy params so we aren't modifying input params = new HashMap<>(params); // copy params so we aren't modifying input
params.putAll(leafLookup.asMap()); // add lookup vars 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; this.params = params;
} }

View File

@ -64,7 +64,7 @@ public abstract class TermsSetQueryScript {
Map<String, Object> parameters = new HashMap<>(params); Map<String, Object> parameters = new HashMap<>(params);
this.leafLookup = lookup.getLeafSearchLookup(leafContext); this.leafLookup = lookup.getLeafSearchLookup(leafContext);
parameters.putAll(leafLookup.asMap()); parameters.putAll(leafLookup.asMap());
this.params = new ParameterMap(parameters, DEPRECATIONS); this.params = new DeprecationMap(parameters, DEPRECATIONS);
} }
protected TermsSetQueryScript() { protected TermsSetQueryScript() {