Fix generics on LeadDocLookup (#23060)
All the warnings were upsetting me. This doesn't change behavior.
This commit is contained in:
parent
832952cb29
commit
f7071325c4
|
@ -33,9 +33,9 @@ import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
public class LeafDocLookup implements Map {
|
public class LeafDocLookup implements Map<String, ScriptDocValues<?>> {
|
||||||
|
|
||||||
private final Map<String, ScriptDocValues> localCacheFieldData = new HashMap<>(4);
|
private final Map<String, ScriptDocValues<?>> localCacheFieldData = new HashMap<>(4);
|
||||||
|
|
||||||
private final MapperService mapperService;
|
private final MapperService mapperService;
|
||||||
private final IndexFieldDataService fieldDataService;
|
private final IndexFieldDataService fieldDataService;
|
||||||
|
@ -67,10 +67,10 @@ public class LeafDocLookup implements Map {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object get(Object key) {
|
public ScriptDocValues<?> get(Object key) {
|
||||||
// assume its a string...
|
// assume its a string...
|
||||||
String fieldName = key.toString();
|
String fieldName = key.toString();
|
||||||
ScriptDocValues scriptValues = localCacheFieldData.get(fieldName);
|
ScriptDocValues<?> scriptValues = localCacheFieldData.get(fieldName);
|
||||||
if (scriptValues == null) {
|
if (scriptValues == null) {
|
||||||
final MappedFieldType fieldType = mapperService.fullName(fieldName);
|
final MappedFieldType fieldType = mapperService.fullName(fieldName);
|
||||||
if (fieldType == null) {
|
if (fieldType == null) {
|
||||||
|
@ -78,9 +78,9 @@ public class LeafDocLookup implements Map {
|
||||||
}
|
}
|
||||||
// load fielddata on behalf of the script: otherwise it would need additional permissions
|
// load fielddata on behalf of the script: otherwise it would need additional permissions
|
||||||
// to deal with pagedbytes/ramusagestimator/etc
|
// to deal with pagedbytes/ramusagestimator/etc
|
||||||
scriptValues = AccessController.doPrivileged(new PrivilegedAction<ScriptDocValues>() {
|
scriptValues = AccessController.doPrivileged(new PrivilegedAction<ScriptDocValues<?>>() {
|
||||||
@Override
|
@Override
|
||||||
public ScriptDocValues run() {
|
public ScriptDocValues<?> run() {
|
||||||
return fieldDataService.getForField(fieldType).load(reader).getScriptValues();
|
return fieldDataService.getForField(fieldType).load(reader).getScriptValues();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -94,7 +94,7 @@ public class LeafDocLookup implements Map {
|
||||||
public boolean containsKey(Object key) {
|
public boolean containsKey(Object key) {
|
||||||
// assume its a string...
|
// assume its a string...
|
||||||
String fieldName = key.toString();
|
String fieldName = key.toString();
|
||||||
ScriptDocValues scriptValues = localCacheFieldData.get(fieldName);
|
ScriptDocValues<?> scriptValues = localCacheFieldData.get(fieldName);
|
||||||
if (scriptValues == null) {
|
if (scriptValues == null) {
|
||||||
MappedFieldType fieldType = mapperService.fullName(fieldName);
|
MappedFieldType fieldType = mapperService.fullName(fieldName);
|
||||||
if (fieldType == null) {
|
if (fieldType == null) {
|
||||||
|
@ -120,17 +120,17 @@ public class LeafDocLookup implements Map {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object put(Object key, Object value) {
|
public ScriptDocValues<?> put(String key, ScriptDocValues<?> value) {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object remove(Object key) {
|
public ScriptDocValues<?> remove(Object key) {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void putAll(Map m) {
|
public void putAll(Map<? extends String, ? extends ScriptDocValues<?>> m) {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -140,17 +140,17 @@ public class LeafDocLookup implements Map {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Set keySet() {
|
public Set<String> keySet() {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Collection values() {
|
public Collection<ScriptDocValues<?>> values() {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Set entrySet() {
|
public Set<Map.Entry<String, ScriptDocValues<?>>> entrySet() {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue