23
23
import org .elasticsearch .common .regex .Regex ;
24
24
25
25
import java .util .Collection ;
26
- import java .util .Collections ;
27
26
import java .util .HashMap ;
28
27
import java .util .HashSet ;
29
28
import java .util .Iterator ;
33
32
/**
34
33
* An immutable container for looking up {@link MappedFieldType}s by their name.
35
34
*/
36
- class FieldTypeLookup implements Iterable <MappedFieldType > {
35
+ final class FieldTypeLookup implements Iterable <MappedFieldType > {
37
36
38
37
private final Map <String , MappedFieldType > fullNameToFieldType = new HashMap <>();
39
38
private final Map <String , String > aliasToConcreteName = new HashMap <>();
@@ -48,10 +47,6 @@ class FieldTypeLookup implements Iterable<MappedFieldType> {
48
47
private final Map <String , Set <String >> fieldToCopiedFields = new HashMap <>();
49
48
private final DynamicKeyFieldTypeLookup dynamicKeyLookup ;
50
49
51
- FieldTypeLookup () {
52
- this (Collections .emptyList (), Collections .emptyList ());
53
- }
54
-
55
50
FieldTypeLookup (Collection <FieldMapper > fieldMappers ,
56
51
Collection <FieldAliasMapper > fieldAliasMappers ) {
57
52
Map <String , DynamicKeyFieldMapper > dynamicKeyMappers = new HashMap <>();
@@ -87,7 +82,7 @@ class FieldTypeLookup implements Iterable<MappedFieldType> {
87
82
/**
88
83
* Returns the mapped field type for the given field name.
89
84
*/
90
- public MappedFieldType get (String field ) {
85
+ MappedFieldType get (String field ) {
91
86
String concreteField = aliasToConcreteName .getOrDefault (field , field );
92
87
MappedFieldType fieldType = fullNameToFieldType .get (concreteField );
93
88
if (fieldType != null ) {
@@ -102,7 +97,7 @@ public MappedFieldType get(String field) {
102
97
/**
103
98
* Returns a list of the full names of a simple match regex like pattern against full name and index name.
104
99
*/
105
- public Set <String > simpleMatchToFullName (String pattern ) {
100
+ Set <String > simpleMatchToFullName (String pattern ) {
106
101
Set <String > fields = new HashSet <>();
107
102
for (MappedFieldType fieldType : this ) {
108
103
if (Regex .simpleMatch (pattern , fieldType .name ())) {
@@ -129,7 +124,7 @@ public Set<String> simpleMatchToFullName(String pattern) {
129
124
* should be a concrete field and *not* an alias.
130
125
* @return A set of paths in the _source that contain the field's values.
131
126
*/
132
- public Set <String > sourcePaths (String field ) {
127
+ Set <String > sourcePaths (String field ) {
133
128
String resolvedField = field ;
134
129
int lastDotIndex = field .lastIndexOf ('.' );
135
130
if (lastDotIndex > 0 ) {
0 commit comments