Simplify generics on Mapper.Builder (#56747)
Mapper.Builder currently has some complex generics on it to allow fluent builder construction. However, the second parameter, a return type from the build() method, is unnecessary, as we can use covariant return types. This commit removes this second generic parameter.
This commit is contained in:
parent
1530bff0cb
commit
d33d13f2be
|
@ -57,7 +57,7 @@ public class RankFeatureFieldMapper extends FieldMapper {
|
|||
}
|
||||
}
|
||||
|
||||
public static class Builder extends FieldMapper.Builder<Builder, RankFeatureFieldMapper> {
|
||||
public static class Builder extends FieldMapper.Builder<Builder> {
|
||||
|
||||
public Builder(String name) {
|
||||
super(name, Defaults.FIELD_TYPE, Defaults.FIELD_TYPE);
|
||||
|
@ -85,7 +85,7 @@ public class RankFeatureFieldMapper extends FieldMapper {
|
|||
|
||||
public static class TypeParser implements Mapper.TypeParser {
|
||||
@Override
|
||||
public Mapper.Builder<?,?> parse(String name, Map<String, Object> node, ParserContext parserContext) throws MapperParsingException {
|
||||
public Mapper.Builder<?> parse(String name, Map<String, Object> node, ParserContext parserContext) throws MapperParsingException {
|
||||
RankFeatureFieldMapper.Builder builder = new RankFeatureFieldMapper.Builder(name);
|
||||
for (Iterator<Map.Entry<String, Object>> iterator = node.entrySet().iterator(); iterator.hasNext();) {
|
||||
Map.Entry<String, Object> entry = iterator.next();
|
||||
|
|
|
@ -56,7 +56,7 @@ public class RankFeatureMetaFieldMapper extends MetadataFieldMapper {
|
|||
}
|
||||
}
|
||||
|
||||
public static class Builder extends MetadataFieldMapper.Builder<Builder, RankFeatureMetaFieldMapper> {
|
||||
public static class Builder extends MetadataFieldMapper.Builder<Builder> {
|
||||
|
||||
public Builder(MappedFieldType existing) {
|
||||
super(NAME, existing == null ? Defaults.FIELD_TYPE : existing, Defaults.FIELD_TYPE);
|
||||
|
@ -71,7 +71,7 @@ public class RankFeatureMetaFieldMapper extends MetadataFieldMapper {
|
|||
|
||||
public static class TypeParser implements MetadataFieldMapper.TypeParser {
|
||||
@Override
|
||||
public MetadataFieldMapper.Builder<?,?> parse(String name,
|
||||
public MetadataFieldMapper.Builder<?> parse(String name,
|
||||
Map<String, Object> node, ParserContext parserContext) throws MapperParsingException {
|
||||
return new Builder(parserContext.mapperService().fieldType(NAME));
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ public class RankFeaturesFieldMapper extends FieldMapper {
|
|||
}
|
||||
}
|
||||
|
||||
public static class Builder extends FieldMapper.Builder<Builder, RankFeaturesFieldMapper> {
|
||||
public static class Builder extends FieldMapper.Builder<Builder> {
|
||||
|
||||
public Builder(String name) {
|
||||
super(name, Defaults.FIELD_TYPE, Defaults.FIELD_TYPE);
|
||||
|
@ -74,7 +74,7 @@ public class RankFeaturesFieldMapper extends FieldMapper {
|
|||
|
||||
public static class TypeParser implements Mapper.TypeParser {
|
||||
@Override
|
||||
public Mapper.Builder<?,?> parse(String name, Map<String, Object> node, ParserContext parserContext) throws MapperParsingException {
|
||||
public Mapper.Builder<?> parse(String name, Map<String, Object> node, ParserContext parserContext) throws MapperParsingException {
|
||||
RankFeaturesFieldMapper.Builder builder = new RankFeaturesFieldMapper.Builder(name);
|
||||
return builder;
|
||||
}
|
||||
|
|
|
@ -82,7 +82,7 @@ public class ScaledFloatFieldMapper extends FieldMapper {
|
|||
// use the same default as numbers
|
||||
private static final Setting<Boolean> COERCE_SETTING = NumberFieldMapper.COERCE_SETTING;
|
||||
|
||||
public static class Builder extends FieldMapper.Builder<Builder, ScaledFloatFieldMapper> {
|
||||
public static class Builder extends FieldMapper.Builder<Builder> {
|
||||
|
||||
private boolean scalingFactorSet = false;
|
||||
private Boolean ignoreMalformed;
|
||||
|
@ -149,7 +149,7 @@ public class ScaledFloatFieldMapper extends FieldMapper {
|
|||
public static class TypeParser implements Mapper.TypeParser {
|
||||
|
||||
@Override
|
||||
public Mapper.Builder<?,?> parse(String name, Map<String, Object> node,
|
||||
public Mapper.Builder<?> parse(String name, Map<String, Object> node,
|
||||
ParserContext parserContext) throws MapperParsingException {
|
||||
Builder builder = new Builder(name);
|
||||
TypeParsers.parseField(builder, name, node, parserContext);
|
||||
|
|
|
@ -104,7 +104,7 @@ public class SearchAsYouTypeFieldMapper extends FieldMapper {
|
|||
public static class TypeParser implements Mapper.TypeParser {
|
||||
|
||||
@Override
|
||||
public Mapper.Builder<?, ?> parse(String name,
|
||||
public Mapper.Builder<?> parse(String name,
|
||||
Map<String, Object> node,
|
||||
ParserContext parserContext) throws MapperParsingException {
|
||||
|
||||
|
@ -129,7 +129,7 @@ public class SearchAsYouTypeFieldMapper extends FieldMapper {
|
|||
}
|
||||
}
|
||||
|
||||
public static class Builder extends FieldMapper.Builder<Builder, SearchAsYouTypeFieldMapper> {
|
||||
public static class Builder extends FieldMapper.Builder<Builder> {
|
||||
private int maxShingleSize = Defaults.MAX_SHINGLE_SIZE;
|
||||
|
||||
public Builder(String name) {
|
||||
|
|
|
@ -47,7 +47,7 @@ public class TokenCountFieldMapper extends FieldMapper {
|
|||
public static final boolean DEFAULT_POSITION_INCREMENTS = true;
|
||||
}
|
||||
|
||||
public static class Builder extends FieldMapper.Builder<Builder, TokenCountFieldMapper> {
|
||||
public static class Builder extends FieldMapper.Builder<Builder> {
|
||||
private NamedAnalyzer analyzer;
|
||||
private boolean enablePositionIncrements = Defaults.DEFAULT_POSITION_INCREMENTS;
|
||||
|
||||
|
@ -84,7 +84,7 @@ public class TokenCountFieldMapper extends FieldMapper {
|
|||
|
||||
public static class TypeParser implements Mapper.TypeParser {
|
||||
@Override
|
||||
public Mapper.Builder<?,?> parse(String name, Map<String, Object> node, ParserContext parserContext) throws MapperParsingException {
|
||||
public Mapper.Builder<?> parse(String name, Map<String, Object> node, ParserContext parserContext) throws MapperParsingException {
|
||||
TokenCountFieldMapper.Builder builder = new TokenCountFieldMapper.Builder(name);
|
||||
for (Iterator<Map.Entry<String, Object>> iterator = node.entrySet().iterator(); iterator.hasNext();) {
|
||||
Map.Entry<String, Object> entry = iterator.next();
|
||||
|
|
|
@ -57,7 +57,7 @@ public class MetaJoinFieldMapper extends FieldMapper {
|
|||
}
|
||||
}
|
||||
|
||||
static class Builder extends FieldMapper.Builder<Builder, MetaJoinFieldMapper> {
|
||||
static class Builder extends FieldMapper.Builder<Builder> {
|
||||
Builder() {
|
||||
super(NAME, Defaults.FIELD_TYPE, Defaults.FIELD_TYPE);
|
||||
builder = this;
|
||||
|
|
|
@ -66,7 +66,7 @@ public final class ParentIdFieldMapper extends FieldMapper {
|
|||
}
|
||||
}
|
||||
|
||||
static class Builder extends FieldMapper.Builder<Builder, ParentIdFieldMapper> {
|
||||
static class Builder extends FieldMapper.Builder<Builder> {
|
||||
private final String parent;
|
||||
private final Set<String> children;
|
||||
|
||||
|
|
|
@ -121,7 +121,7 @@ public final class ParentJoinFieldMapper extends FieldMapper {
|
|||
}
|
||||
}
|
||||
|
||||
public static class Builder extends FieldMapper.Builder<Builder, ParentJoinFieldMapper> {
|
||||
public static class Builder extends FieldMapper.Builder<Builder> {
|
||||
final List<ParentIdFieldMapper.Builder> parentIdFieldBuilders = new ArrayList<>();
|
||||
boolean eagerGlobalOrdinals = true;
|
||||
|
||||
|
@ -168,7 +168,7 @@ public final class ParentJoinFieldMapper extends FieldMapper {
|
|||
|
||||
public static class TypeParser implements Mapper.TypeParser {
|
||||
@Override
|
||||
public Mapper.Builder<?,?> parse(String name, Map<String, Object> node, ParserContext parserContext) throws MapperParsingException {
|
||||
public Mapper.Builder<?> parse(String name, Map<String, Object> node, ParserContext parserContext) throws MapperParsingException {
|
||||
final IndexSettings indexSettings = parserContext.mapperService().getIndexSettings();
|
||||
checkIndexCompatibility(indexSettings, name);
|
||||
|
||||
|
|
|
@ -111,7 +111,7 @@ public class PercolatorFieldMapper extends FieldMapper {
|
|||
static final String RANGE_FIELD_NAME = "range_field";
|
||||
static final String MINIMUM_SHOULD_MATCH_FIELD_NAME = "minimum_should_match_field";
|
||||
|
||||
static class Builder extends FieldMapper.Builder<Builder, PercolatorFieldMapper> {
|
||||
static class Builder extends FieldMapper.Builder<Builder> {
|
||||
|
||||
private final Supplier<QueryShardContext> queryShardContext;
|
||||
|
||||
|
|
|
@ -221,7 +221,7 @@ public class ICUCollationKeywordFieldMapper extends FieldMapper {
|
|||
}
|
||||
}
|
||||
|
||||
public static class Builder extends FieldMapper.Builder<Builder, ICUCollationKeywordFieldMapper> {
|
||||
public static class Builder extends FieldMapper.Builder<Builder> {
|
||||
private String rules = null;
|
||||
private String language = null;
|
||||
private String country = null;
|
||||
|
@ -481,7 +481,7 @@ public class ICUCollationKeywordFieldMapper extends FieldMapper {
|
|||
|
||||
public static class TypeParser implements Mapper.TypeParser {
|
||||
@Override
|
||||
public Mapper.Builder<?, ?> parse(String name, Map<String, Object> node, ParserContext parserContext)
|
||||
public Mapper.Builder<?> parse(String name, Map<String, Object> node, ParserContext parserContext)
|
||||
throws MapperParsingException {
|
||||
Builder builder = new Builder(name);
|
||||
TypeParsers.parseField(builder, name, node, parserContext);
|
||||
|
|
|
@ -85,7 +85,7 @@ public class AnnotatedTextFieldMapper extends FieldMapper {
|
|||
}
|
||||
}
|
||||
|
||||
public static class Builder extends FieldMapper.Builder<Builder, AnnotatedTextFieldMapper> {
|
||||
public static class Builder extends FieldMapper.Builder<Builder> {
|
||||
|
||||
private int positionIncrementGap = POSITION_INCREMENT_GAP_USE_ANALYZER;
|
||||
|
||||
|
@ -147,7 +147,7 @@ public class AnnotatedTextFieldMapper extends FieldMapper {
|
|||
|
||||
public static class TypeParser implements Mapper.TypeParser {
|
||||
@Override
|
||||
public Mapper.Builder<AnnotatedTextFieldMapper.Builder, AnnotatedTextFieldMapper> parse(
|
||||
public Mapper.Builder<AnnotatedTextFieldMapper.Builder> parse(
|
||||
String fieldName, Map<String, Object> node, ParserContext parserContext) throws MapperParsingException {
|
||||
AnnotatedTextFieldMapper.Builder builder = new AnnotatedTextFieldMapper.Builder(fieldName);
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ public class Murmur3FieldMapper extends FieldMapper {
|
|||
}
|
||||
}
|
||||
|
||||
public static class Builder extends FieldMapper.Builder<Builder, Murmur3FieldMapper> {
|
||||
public static class Builder extends FieldMapper.Builder<Builder> {
|
||||
|
||||
public Builder(String name) {
|
||||
super(name, Defaults.FIELD_TYPE, Defaults.FIELD_TYPE);
|
||||
|
@ -81,7 +81,7 @@ public class Murmur3FieldMapper extends FieldMapper {
|
|||
|
||||
public static class TypeParser implements Mapper.TypeParser {
|
||||
@Override
|
||||
public Mapper.Builder<?, ?> parse(String name, Map<String, Object> node, ParserContext parserContext)
|
||||
public Mapper.Builder<?> parse(String name, Map<String, Object> node, ParserContext parserContext)
|
||||
throws MapperParsingException {
|
||||
Builder builder = new Builder(name);
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@ public class SizeFieldMapper extends MetadataFieldMapper {
|
|||
return defaultFieldType;
|
||||
}
|
||||
|
||||
public static class Builder extends MetadataFieldMapper.Builder<Builder, SizeFieldMapper> {
|
||||
public static class Builder extends MetadataFieldMapper.Builder<Builder> {
|
||||
|
||||
protected EnabledAttributeMapper enabledState = EnabledAttributeMapper.UNSET_DISABLED;
|
||||
|
||||
|
@ -86,7 +86,7 @@ public class SizeFieldMapper extends MetadataFieldMapper {
|
|||
|
||||
public static class TypeParser implements MetadataFieldMapper.TypeParser {
|
||||
@Override
|
||||
public MetadataFieldMapper.Builder<?, ?> parse(String name, Map<String, Object> node,
|
||||
public MetadataFieldMapper.Builder<?> parse(String name, Map<String, Object> node,
|
||||
ParserContext parserContext) throws MapperParsingException {
|
||||
Builder builder = new Builder(parserContext.mapperService().fieldType(NAME),
|
||||
parserContext.indexVersionCreated());
|
||||
|
|
|
@ -76,8 +76,8 @@ public abstract class AbstractGeometryFieldMapper<Parsed, Processed> extends Fie
|
|||
Parsed parse(XContentParser parser, AbstractGeometryFieldMapper mapper) throws IOException, ParseException;
|
||||
}
|
||||
|
||||
public abstract static class Builder<T extends Builder, Y extends AbstractGeometryFieldMapper, FT extends AbstractGeometryFieldType>
|
||||
extends FieldMapper.Builder<T, Y> {
|
||||
public abstract static class Builder<T extends Builder, FT extends AbstractGeometryFieldType>
|
||||
extends FieldMapper.Builder<T> {
|
||||
protected Boolean ignoreMalformed;
|
||||
protected Boolean ignoreZValue;
|
||||
|
||||
|
|
|
@ -44,20 +44,20 @@ public abstract class AbstractPointGeometryFieldMapper<Parsed, Processed> extend
|
|||
public static final ParseField NULL_VALUE = new ParseField("null_value");
|
||||
}
|
||||
|
||||
public abstract static class Builder<T extends Builder, Y extends AbstractPointGeometryFieldMapper,
|
||||
FT extends AbstractPointGeometryFieldType> extends AbstractGeometryFieldMapper.Builder<T, Y, FT> {
|
||||
public abstract static class Builder<T extends Builder,
|
||||
FT extends AbstractPointGeometryFieldType> extends AbstractGeometryFieldMapper.Builder<T, FT> {
|
||||
public Builder(String name, MappedFieldType fieldType, MappedFieldType defaultFieldType) {
|
||||
super(name, fieldType, defaultFieldType);
|
||||
}
|
||||
|
||||
public abstract Y build(BuilderContext context, String simpleName, MappedFieldType fieldType,
|
||||
public abstract AbstractPointGeometryFieldMapper build(BuilderContext context, String simpleName, MappedFieldType fieldType,
|
||||
MappedFieldType defaultFieldType, Settings indexSettings,
|
||||
MultiFields multiFields, Explicit<Boolean> ignoreMalformed, Explicit<Boolean> ignoreZValue,
|
||||
CopyTo copyTo);
|
||||
|
||||
|
||||
@Override
|
||||
public Y build(BuilderContext context) {
|
||||
public AbstractPointGeometryFieldMapper build(BuilderContext context) {
|
||||
return build(context, name, fieldType, defaultFieldType, context.indexSettings(),
|
||||
multiFieldsBuilder.build(this, context), ignoreMalformed(context),
|
||||
ignoreZValue(context), copyTo);
|
||||
|
|
|
@ -49,8 +49,8 @@ public abstract class AbstractShapeGeometryFieldMapper<Parsed, Processed> extend
|
|||
public static final Explicit<Boolean> COERCE = new Explicit<>(false, false);
|
||||
}
|
||||
|
||||
public abstract static class Builder<T extends Builder, Y extends AbstractShapeGeometryFieldMapper,
|
||||
FT extends AbstractShapeGeometryFieldType> extends AbstractGeometryFieldMapper.Builder<T, Y, FT> {
|
||||
public abstract static class Builder<T extends Builder,
|
||||
FT extends AbstractShapeGeometryFieldType> extends AbstractGeometryFieldMapper.Builder<T, FT> {
|
||||
protected Boolean coerce;
|
||||
protected Orientation orientation;
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ public class AllFieldMapper extends MetadataFieldMapper {
|
|||
}
|
||||
}
|
||||
|
||||
public static class Builder extends MetadataFieldMapper.Builder<Builder, AllFieldMapper> {
|
||||
public static class Builder extends MetadataFieldMapper.Builder<Builder> {
|
||||
private boolean disableExplicit = false;
|
||||
|
||||
public Builder(MappedFieldType existing) {
|
||||
|
@ -73,7 +73,7 @@ public class AllFieldMapper extends MetadataFieldMapper {
|
|||
|
||||
public static class TypeParser implements MetadataFieldMapper.TypeParser {
|
||||
@Override
|
||||
public MetadataFieldMapper.Builder<?,?> parse(String name, Map<String, Object> node,
|
||||
public MetadataFieldMapper.Builder<?> parse(String name, Map<String, Object> node,
|
||||
ParserContext parserContext) throws MapperParsingException {
|
||||
Builder builder = new Builder(parserContext.mapperService().fieldType(NAME));
|
||||
for (Iterator<Map.Entry<String, Object>> iterator = node.entrySet().iterator(); iterator.hasNext();) {
|
||||
|
|
|
@ -62,7 +62,7 @@ public class BinaryFieldMapper extends FieldMapper {
|
|||
}
|
||||
}
|
||||
|
||||
public static class Builder extends FieldMapper.Builder<Builder, BinaryFieldMapper> {
|
||||
public static class Builder extends FieldMapper.Builder<Builder> {
|
||||
|
||||
public Builder(String name) {
|
||||
super(name, Defaults.FIELD_TYPE, Defaults.FIELD_TYPE);
|
||||
|
|
|
@ -74,7 +74,7 @@ public class BooleanFieldMapper extends FieldMapper {
|
|||
public static final BytesRef FALSE = new BytesRef("F");
|
||||
}
|
||||
|
||||
public static class Builder extends FieldMapper.Builder<Builder, BooleanFieldMapper> {
|
||||
public static class Builder extends FieldMapper.Builder<Builder> {
|
||||
|
||||
public Builder(String name) {
|
||||
super(name, Defaults.FIELD_TYPE, Defaults.FIELD_TYPE);
|
||||
|
|
|
@ -123,7 +123,7 @@ public class CompletionFieldMapper extends FieldMapper implements ArrayValueMapp
|
|||
public static class TypeParser implements Mapper.TypeParser {
|
||||
|
||||
@Override
|
||||
public Mapper.Builder<?, ?> parse(String name, Map<String, Object> node, ParserContext parserContext)
|
||||
public Mapper.Builder<?> parse(String name, Map<String, Object> node, ParserContext parserContext)
|
||||
throws MapperParsingException {
|
||||
CompletionFieldMapper.Builder builder = new CompletionFieldMapper.Builder(name);
|
||||
NamedAnalyzer indexAnalyzer = null;
|
||||
|
@ -353,7 +353,7 @@ public class CompletionFieldMapper extends FieldMapper implements ArrayValueMapp
|
|||
/**
|
||||
* Builder for {@link CompletionFieldMapper}
|
||||
*/
|
||||
public static class Builder extends FieldMapper.Builder<Builder, CompletionFieldMapper> {
|
||||
public static class Builder extends FieldMapper.Builder<Builder> {
|
||||
|
||||
private int maxInputLength = Defaults.DEFAULT_MAX_INPUT_LENGTH;
|
||||
private ContextMappings contextMappings = null;
|
||||
|
|
|
@ -173,7 +173,7 @@ public final class DateFieldMapper extends FieldMapper {
|
|||
}
|
||||
}
|
||||
|
||||
public static class Builder extends FieldMapper.Builder<Builder, DateFieldMapper> {
|
||||
public static class Builder extends FieldMapper.Builder<Builder> {
|
||||
|
||||
private Boolean ignoreMalformed;
|
||||
private Explicit<String> format = new Explicit<>(DEFAULT_DATE_TIME_FORMATTER.pattern(), false);
|
||||
|
@ -270,7 +270,7 @@ public final class DateFieldMapper extends FieldMapper {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Mapper.Builder<?,?> parse(String name, Map<String, Object> node, ParserContext parserContext) throws MapperParsingException {
|
||||
public Mapper.Builder<?> parse(String name, Map<String, Object> node, ParserContext parserContext) throws MapperParsingException {
|
||||
Builder builder = new Builder(name);
|
||||
builder.withResolution(resolution);
|
||||
TypeParsers.parseField(builder, name, node, parserContext);
|
||||
|
|
|
@ -99,7 +99,7 @@ public class DocumentMapper implements ToXContentFragment {
|
|||
return this;
|
||||
}
|
||||
|
||||
public Builder put(MetadataFieldMapper.Builder<?, ?> mapper) {
|
||||
public Builder put(MetadataFieldMapper.Builder<?> mapper) {
|
||||
MetadataFieldMapper metadataMapper = mapper.build(builderContext);
|
||||
metadataMappers.put(metadataMapper.getClass(), metadataMapper);
|
||||
return this;
|
||||
|
|
|
@ -635,7 +635,7 @@ final class DocumentParser {
|
|||
}
|
||||
}
|
||||
|
||||
private static Mapper.Builder<?,?> createBuilderFromFieldType(final ParseContext context,
|
||||
private static Mapper.Builder<?> createBuilderFromFieldType(final ParseContext context,
|
||||
MappedFieldType fieldType, String currentFieldName) {
|
||||
Mapper.Builder builder = null;
|
||||
if (fieldType instanceof TextFieldType) {
|
||||
|
@ -682,15 +682,15 @@ final class DocumentParser {
|
|||
return builder;
|
||||
}
|
||||
|
||||
private static Mapper.Builder<?, ?> newLongBuilder(String name, Version indexCreated) {
|
||||
private static Mapper.Builder<?> newLongBuilder(String name, Version indexCreated) {
|
||||
return new NumberFieldMapper.Builder(name, NumberFieldMapper.NumberType.LONG);
|
||||
}
|
||||
|
||||
private static Mapper.Builder<?, ?> newFloatBuilder(String name, Version indexCreated) {
|
||||
private static Mapper.Builder<?> newFloatBuilder(String name, Version indexCreated) {
|
||||
return new NumberFieldMapper.Builder(name, NumberFieldMapper.NumberType.FLOAT);
|
||||
}
|
||||
|
||||
private static Mapper.Builder<?, ?> newDateBuilder(String name, DateFormatter dateTimeFormatter, Version indexCreated) {
|
||||
private static Mapper.Builder<?> newDateBuilder(String name, DateFormatter dateTimeFormatter, Version indexCreated) {
|
||||
DateFieldMapper.Builder builder = new DateFieldMapper.Builder(name);
|
||||
if (dateTimeFormatter != null) {
|
||||
builder.format(dateTimeFormatter.pattern()).locale(dateTimeFormatter.locale());
|
||||
|
@ -698,7 +698,7 @@ final class DocumentParser {
|
|||
return builder;
|
||||
}
|
||||
|
||||
private static Mapper.Builder<?,?> createBuilderFromDynamicValue(final ParseContext context,
|
||||
private static Mapper.Builder<?> createBuilderFromDynamicValue(final ParseContext context,
|
||||
XContentParser.Token token,
|
||||
String currentFieldName) throws IOException {
|
||||
if (token == XContentParser.Token.VALUE_STRING) {
|
||||
|
|
|
@ -106,7 +106,7 @@ public final class FieldAliasMapper extends Mapper {
|
|||
}
|
||||
}
|
||||
|
||||
public static class Builder extends Mapper.Builder<FieldAliasMapper.Builder, FieldAliasMapper> {
|
||||
public static class Builder extends Mapper.Builder<FieldAliasMapper.Builder> {
|
||||
private String name;
|
||||
private String path;
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ public abstract class FieldMapper extends Mapper implements Cloneable {
|
|||
Setting.boolSetting("index.mapping.ignore_malformed", false, Property.IndexScope);
|
||||
public static final Setting<Boolean> COERCE_SETTING =
|
||||
Setting.boolSetting("index.mapping.coerce", false, Property.IndexScope);
|
||||
public abstract static class Builder<T extends Builder, Y extends FieldMapper> extends Mapper.Builder<T, Y> {
|
||||
public abstract static class Builder<T extends Builder> extends Mapper.Builder<T> {
|
||||
|
||||
protected final MappedFieldType fieldType;
|
||||
protected final MappedFieldType defaultFieldType;
|
||||
|
@ -192,7 +192,7 @@ public abstract class FieldMapper extends Mapper implements Cloneable {
|
|||
return this;
|
||||
}
|
||||
|
||||
public T addMultiField(Mapper.Builder<?, ?> mapperBuilder) {
|
||||
public T addMultiField(Mapper.Builder<?> mapperBuilder) {
|
||||
multiFieldsBuilder.add(mapperBuilder);
|
||||
return builder;
|
||||
}
|
||||
|
|
|
@ -73,7 +73,7 @@ public class FieldNamesFieldMapper extends MetadataFieldMapper {
|
|||
}
|
||||
}
|
||||
|
||||
private static class Builder extends MetadataFieldMapper.Builder<Builder, FieldNamesFieldMapper> {
|
||||
private static class Builder extends MetadataFieldMapper.Builder<Builder> {
|
||||
private boolean enabled = Defaults.ENABLED;
|
||||
|
||||
private Builder(MappedFieldType existing) {
|
||||
|
@ -102,7 +102,7 @@ public class FieldNamesFieldMapper extends MetadataFieldMapper {
|
|||
+ "will be removed in a future major version. Please remove it from your mappings and templates.";
|
||||
|
||||
@Override
|
||||
public MetadataFieldMapper.Builder<?,?> parse(String name, Map<String, Object> node,
|
||||
public MetadataFieldMapper.Builder<?> parse(String name, Map<String, Object> node,
|
||||
ParserContext parserContext) throws MapperParsingException {
|
||||
Builder builder = new Builder(parserContext.mapperService().fieldType(NAME));
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@ public class GeoPointFieldMapper extends AbstractPointGeometryFieldMapper<List<?
|
|||
implements ArrayValueMapperParser {
|
||||
public static final String CONTENT_TYPE = "geo_point";
|
||||
|
||||
public static class Builder extends AbstractPointGeometryFieldMapper.Builder<Builder, GeoPointFieldMapper, GeoPointFieldType> {
|
||||
public static class Builder extends AbstractPointGeometryFieldMapper.Builder<Builder, GeoPointFieldType> {
|
||||
public Builder(String name) {
|
||||
super(name, new GeoPointFieldType(), new GeoPointFieldType());
|
||||
builder = this;
|
||||
|
|
|
@ -53,7 +53,7 @@ public class GeoShapeFieldMapper extends AbstractShapeGeometryFieldMapper<Geomet
|
|||
public static final String CONTENT_TYPE = "geo_shape";
|
||||
|
||||
public static class Builder extends AbstractShapeGeometryFieldMapper.Builder<AbstractShapeGeometryFieldMapper.Builder,
|
||||
GeoShapeFieldMapper, GeoShapeFieldType> {
|
||||
GeoShapeFieldType> {
|
||||
public Builder(String name) {
|
||||
super (name, new GeoShapeFieldType(), new GeoShapeFieldType());
|
||||
}
|
||||
|
|
|
@ -97,7 +97,7 @@ public class IdFieldMapper extends MetadataFieldMapper {
|
|||
|
||||
public static class TypeParser implements MetadataFieldMapper.TypeParser {
|
||||
@Override
|
||||
public MetadataFieldMapper.Builder parse(String name, Map<String, Object> node,
|
||||
public MetadataFieldMapper.Builder<?> parse(String name, Map<String, Object> node,
|
||||
ParserContext parserContext) throws MapperParsingException {
|
||||
throw new MapperParsingException(NAME + " is not configurable");
|
||||
}
|
||||
|
|
|
@ -57,7 +57,7 @@ public final class IgnoredFieldMapper extends MetadataFieldMapper {
|
|||
}
|
||||
}
|
||||
|
||||
public static class Builder extends MetadataFieldMapper.Builder<Builder, IgnoredFieldMapper> {
|
||||
public static class Builder extends MetadataFieldMapper.Builder<Builder> {
|
||||
|
||||
public Builder(MappedFieldType existing) {
|
||||
super(Defaults.NAME, existing == null ? Defaults.FIELD_TYPE : existing, Defaults.FIELD_TYPE);
|
||||
|
@ -71,7 +71,7 @@ public final class IgnoredFieldMapper extends MetadataFieldMapper {
|
|||
|
||||
public static class TypeParser implements MetadataFieldMapper.TypeParser {
|
||||
@Override
|
||||
public MetadataFieldMapper.Builder<?,?> parse(String name, Map<String, Object> node,
|
||||
public MetadataFieldMapper.Builder<?> parse(String name, Map<String, Object> node,
|
||||
ParserContext parserContext) throws MapperParsingException {
|
||||
return new Builder(parserContext.mapperService().fieldType(NAME));
|
||||
}
|
||||
|
|
|
@ -58,7 +58,7 @@ public class IndexFieldMapper extends MetadataFieldMapper {
|
|||
}
|
||||
}
|
||||
|
||||
public static class Builder extends MetadataFieldMapper.Builder<Builder, IndexFieldMapper> {
|
||||
public static class Builder extends MetadataFieldMapper.Builder<Builder> {
|
||||
|
||||
public Builder(MappedFieldType existing) {
|
||||
super(Defaults.NAME, existing == null ? Defaults.FIELD_TYPE : existing, Defaults.FIELD_TYPE);
|
||||
|
@ -73,7 +73,7 @@ public class IndexFieldMapper extends MetadataFieldMapper {
|
|||
|
||||
public static class TypeParser implements MetadataFieldMapper.TypeParser {
|
||||
@Override
|
||||
public MetadataFieldMapper.Builder<?,?> parse(String name, Map<String, Object> node,
|
||||
public MetadataFieldMapper.Builder<?> parse(String name, Map<String, Object> node,
|
||||
ParserContext parserContext) throws MapperParsingException {
|
||||
throw new MapperParsingException(NAME + " is not configurable");
|
||||
}
|
||||
|
|
|
@ -63,7 +63,7 @@ public class IpFieldMapper extends FieldMapper {
|
|||
public static final Explicit<Boolean> IGNORE_MALFORMED = new Explicit<>(false, false);
|
||||
}
|
||||
|
||||
public static class Builder extends FieldMapper.Builder<Builder, IpFieldMapper> {
|
||||
public static class Builder extends FieldMapper.Builder<Builder> {
|
||||
|
||||
private Boolean ignoreMalformed;
|
||||
|
||||
|
@ -101,7 +101,7 @@ public class IpFieldMapper extends FieldMapper {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Mapper.Builder<?,?> parse(String name, Map<String, Object> node, ParserContext parserContext) throws MapperParsingException {
|
||||
public Mapper.Builder<?> parse(String name, Map<String, Object> node, ParserContext parserContext) throws MapperParsingException {
|
||||
Builder builder = new Builder(name);
|
||||
TypeParsers.parseField(builder, name, node, parserContext);
|
||||
for (Iterator<Map.Entry<String, Object>> iterator = node.entrySet().iterator(); iterator.hasNext();) {
|
||||
|
|
|
@ -74,7 +74,7 @@ public final class KeywordFieldMapper extends FieldMapper {
|
|||
public static final int IGNORE_ABOVE = Integer.MAX_VALUE;
|
||||
}
|
||||
|
||||
public static class Builder extends FieldMapper.Builder<Builder, KeywordFieldMapper> {
|
||||
public static class Builder extends FieldMapper.Builder<Builder> {
|
||||
|
||||
protected String nullValue = Defaults.NULL_VALUE;
|
||||
protected int ignoreAbove = Defaults.IGNORE_ABOVE;
|
||||
|
@ -151,7 +151,7 @@ public final class KeywordFieldMapper extends FieldMapper {
|
|||
|
||||
public static class TypeParser implements Mapper.TypeParser {
|
||||
@Override
|
||||
public Mapper.Builder<?,?> parse(String name, Map<String, Object> node, ParserContext parserContext) throws MapperParsingException {
|
||||
public Mapper.Builder<?> parse(String name, Map<String, Object> node, ParserContext parserContext) throws MapperParsingException {
|
||||
KeywordFieldMapper.Builder builder = new KeywordFieldMapper.Builder(name);
|
||||
parseField(builder, name, node, parserContext);
|
||||
for (Iterator<Map.Entry<String, Object>> iterator = node.entrySet().iterator(); iterator.hasNext();) {
|
||||
|
|
|
@ -180,7 +180,7 @@ public class LegacyGeoShapeFieldMapper extends AbstractShapeGeometryFieldMapper<
|
|||
private static final DeprecationLogger DEPRECATION_LOGGER = new DeprecationLogger(logger);
|
||||
|
||||
public static class Builder extends AbstractShapeGeometryFieldMapper.Builder<AbstractShapeGeometryFieldMapper.Builder,
|
||||
LegacyGeoShapeFieldMapper, LegacyGeoShapeFieldMapper.GeoShapeFieldType> {
|
||||
LegacyGeoShapeFieldMapper.GeoShapeFieldType> {
|
||||
|
||||
DeprecatedParameters deprecatedParameters;
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ public abstract class Mapper implements ToXContentFragment, Iterable<Mapper> {
|
|||
}
|
||||
}
|
||||
|
||||
public abstract static class Builder<T extends Builder, Y extends Mapper> {
|
||||
public abstract static class Builder<T extends Builder> {
|
||||
|
||||
public String name;
|
||||
|
||||
|
@ -71,7 +71,7 @@ public abstract class Mapper implements ToXContentFragment, Iterable<Mapper> {
|
|||
}
|
||||
|
||||
/** Returns a newly built mapper. */
|
||||
public abstract Y build(BuilderContext context);
|
||||
public abstract Mapper build(BuilderContext context);
|
||||
}
|
||||
|
||||
public interface TypeParser {
|
||||
|
@ -144,7 +144,7 @@ public abstract class Mapper implements ToXContentFragment, Iterable<Mapper> {
|
|||
|
||||
}
|
||||
|
||||
Mapper.Builder<?,?> parse(String name, Map<String, Object> node, ParserContext parserContext) throws MapperParsingException;
|
||||
Mapper.Builder<?> parse(String name, Map<String, Object> node, ParserContext parserContext) throws MapperParsingException;
|
||||
}
|
||||
|
||||
private final String simpleName;
|
||||
|
|
|
@ -796,7 +796,7 @@ public class MapperService extends AbstractIndexComponent implements Closeable {
|
|||
if (typeParser == null) {
|
||||
throw new IllegalArgumentException("No mapper found for type [" + type + "]");
|
||||
}
|
||||
final Mapper.Builder<?, ?> builder = typeParser.parse("__anonymous_" + type, emptyMap(), parserContext);
|
||||
final Mapper.Builder<?> builder = typeParser.parse("__anonymous_" + type, emptyMap(), parserContext);
|
||||
final BuilderContext builderContext = new BuilderContext(indexSettings.getSettings(), new ContentPath(1));
|
||||
fieldType = ((FieldMapper)builder.build(builderContext)).fieldType();
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ public abstract class MetadataFieldMapper extends FieldMapper {
|
|||
public interface TypeParser extends Mapper.TypeParser {
|
||||
|
||||
@Override
|
||||
MetadataFieldMapper.Builder<?,?> parse(String name, Map<String, Object> node,
|
||||
MetadataFieldMapper.Builder<?> parse(String name, Map<String, Object> node,
|
||||
ParserContext parserContext) throws MapperParsingException;
|
||||
|
||||
/**
|
||||
|
@ -47,10 +47,13 @@ public abstract class MetadataFieldMapper extends FieldMapper {
|
|||
MetadataFieldMapper getDefault(MappedFieldType fieldType, ParserContext parserContext);
|
||||
}
|
||||
|
||||
public abstract static class Builder<T extends Builder, Y extends MetadataFieldMapper> extends FieldMapper.Builder<T, Y> {
|
||||
@SuppressWarnings("rawtypes")
|
||||
public abstract static class Builder<T extends Builder> extends FieldMapper.Builder<T> {
|
||||
public Builder(String name, MappedFieldType fieldType, MappedFieldType defaultFieldType) {
|
||||
super(name, fieldType, defaultFieldType);
|
||||
}
|
||||
|
||||
public abstract MetadataFieldMapper build(BuilderContext context);
|
||||
}
|
||||
|
||||
protected MetadataFieldMapper(String simpleName, MappedFieldType fieldType, MappedFieldType defaultFieldType, Settings indexSettings) {
|
||||
|
|
|
@ -78,7 +78,7 @@ public class NumberFieldMapper extends FieldMapper {
|
|||
public static final Explicit<Boolean> COERCE = new Explicit<>(true, false);
|
||||
}
|
||||
|
||||
public static class Builder extends FieldMapper.Builder<Builder, NumberFieldMapper> {
|
||||
public static class Builder extends FieldMapper.Builder<Builder> {
|
||||
|
||||
private Boolean ignoreMalformed;
|
||||
private Boolean coerce;
|
||||
|
@ -146,7 +146,7 @@ public class NumberFieldMapper extends FieldMapper {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Mapper.Builder<?,?> parse(String name, Map<String, Object> node,
|
||||
public Mapper.Builder<?> parse(String name, Map<String, Object> node,
|
||||
ParserContext parserContext) throws MapperParsingException {
|
||||
Builder builder = new Builder(name, type);
|
||||
TypeParsers.parseField(builder, name, node, parserContext);
|
||||
|
|
|
@ -95,7 +95,8 @@ public class ObjectMapper extends Mapper implements Cloneable {
|
|||
}
|
||||
}
|
||||
|
||||
public static class Builder<T extends Builder, Y extends ObjectMapper> extends Mapper.Builder<T, Y> {
|
||||
@SuppressWarnings("rawtypes")
|
||||
public static class Builder<T extends Builder> extends Mapper.Builder<T> {
|
||||
|
||||
protected boolean enabled = Defaults.ENABLED;
|
||||
|
||||
|
@ -131,7 +132,7 @@ public class ObjectMapper extends Mapper implements Cloneable {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Y build(BuilderContext context) {
|
||||
public ObjectMapper build(BuilderContext context) {
|
||||
context.path().add(name);
|
||||
|
||||
Map<String, Mapper> mappers = new HashMap<>();
|
||||
|
@ -148,7 +149,7 @@ public class ObjectMapper extends Mapper implements Cloneable {
|
|||
ObjectMapper objectMapper = createMapper(name, context.path().pathAsText(name), enabled, nested, dynamic,
|
||||
mappers, context.indexSettings());
|
||||
|
||||
return (Y) objectMapper;
|
||||
return objectMapper;
|
||||
}
|
||||
|
||||
protected ObjectMapper createMapper(String name, String fullPath, boolean enabled, Nested nested, Dynamic dynamic,
|
||||
|
@ -274,9 +275,9 @@ public class ObjectMapper extends Mapper implements Cloneable {
|
|||
}
|
||||
String[] fieldNameParts = fieldName.split("\\.");
|
||||
String realFieldName = fieldNameParts[fieldNameParts.length - 1];
|
||||
Mapper.Builder<?,?> fieldBuilder = typeParser.parse(realFieldName, propNode, parserContext);
|
||||
Mapper.Builder<?> fieldBuilder = typeParser.parse(realFieldName, propNode, parserContext);
|
||||
for (int i = fieldNameParts.length - 2; i >= 0; --i) {
|
||||
ObjectMapper.Builder<?, ?> intermediate = new ObjectMapper.Builder<>(fieldNameParts[i]);
|
||||
ObjectMapper.Builder<?> intermediate = new ObjectMapper.Builder<>(fieldNameParts[i]);
|
||||
intermediate.add(fieldBuilder);
|
||||
fieldBuilder = intermediate;
|
||||
}
|
||||
|
|
|
@ -78,7 +78,7 @@ public class RangeFieldMapper extends FieldMapper {
|
|||
static final Setting<Boolean> COERCE_SETTING =
|
||||
Setting.boolSetting("index.mapping.coerce", true, Setting.Property.IndexScope);
|
||||
|
||||
public static class Builder extends FieldMapper.Builder<Builder, RangeFieldMapper> {
|
||||
public static class Builder extends FieldMapper.Builder<Builder> {
|
||||
private Boolean coerce;
|
||||
private Locale locale = Locale.ROOT;
|
||||
private String pattern;
|
||||
|
@ -161,7 +161,7 @@ public class RangeFieldMapper extends FieldMapper {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Mapper.Builder<?,?> parse(String name, Map<String, Object> node,
|
||||
public Mapper.Builder<?> parse(String name, Map<String, Object> node,
|
||||
ParserContext parserContext) throws MapperParsingException {
|
||||
Builder builder = new Builder(name, type);
|
||||
TypeParsers.parseField(builder, name, node, parserContext);
|
||||
|
|
|
@ -59,7 +59,7 @@ public class RootObjectMapper extends ObjectMapper {
|
|||
public static final boolean NUMERIC_DETECTION = false;
|
||||
}
|
||||
|
||||
public static class Builder extends ObjectMapper.Builder<Builder, RootObjectMapper> {
|
||||
public static class Builder extends ObjectMapper.Builder<Builder> {
|
||||
|
||||
protected Explicit<DynamicTemplate[]> dynamicTemplates = new Explicit<>(new DynamicTemplate[0], false);
|
||||
protected Explicit<DateFormatter[]> dynamicDateTimeFormatters = new Explicit<>(Defaults.DYNAMIC_DATE_TIME_FORMATTERS, false);
|
||||
|
@ -84,7 +84,7 @@ public class RootObjectMapper extends ObjectMapper {
|
|||
@Override
|
||||
public RootObjectMapper build(BuilderContext context) {
|
||||
fixRedundantIncludes(this, true);
|
||||
return super.build(context);
|
||||
return (RootObjectMapper) super.build(context);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -366,7 +366,7 @@ public class RootObjectMapper extends ObjectMapper {
|
|||
Map<String, Object> fieldTypeConfig = dynamicTemplate.mappingForName("__dummy__", defaultDynamicType);
|
||||
fieldTypeConfig.remove("type");
|
||||
try {
|
||||
Mapper.Builder<?, ?> dummyBuilder = typeParser.parse("__dummy__", fieldTypeConfig, parserContext);
|
||||
Mapper.Builder<?> dummyBuilder = typeParser.parse("__dummy__", fieldTypeConfig, parserContext);
|
||||
if (fieldTypeConfig.isEmpty()) {
|
||||
Settings indexSettings = parserContext.mapperService().getIndexSettings().getSettings();
|
||||
BuilderContext builderContext = new BuilderContext(indexSettings, new ContentPath(1));
|
||||
|
|
|
@ -59,7 +59,7 @@ public class RoutingFieldMapper extends MetadataFieldMapper {
|
|||
public static final boolean REQUIRED = false;
|
||||
}
|
||||
|
||||
public static class Builder extends MetadataFieldMapper.Builder<Builder, RoutingFieldMapper> {
|
||||
public static class Builder extends MetadataFieldMapper.Builder<Builder> {
|
||||
|
||||
private boolean required = Defaults.REQUIRED;
|
||||
|
||||
|
@ -80,7 +80,7 @@ public class RoutingFieldMapper extends MetadataFieldMapper {
|
|||
|
||||
public static class TypeParser implements MetadataFieldMapper.TypeParser {
|
||||
@Override
|
||||
public MetadataFieldMapper.Builder<?,?> parse(String name, Map<String, Object> node,
|
||||
public MetadataFieldMapper.Builder<?> parse(String name, Map<String, Object> node,
|
||||
ParserContext parserContext) throws MapperParsingException {
|
||||
Builder builder = new Builder(parserContext.mapperService().fieldType(NAME));
|
||||
for (Iterator<Map.Entry<String, Object>> iterator = node.entrySet().iterator(); iterator.hasNext();) {
|
||||
|
|
|
@ -106,7 +106,7 @@ public class SeqNoFieldMapper extends MetadataFieldMapper {
|
|||
}
|
||||
}
|
||||
|
||||
public static class Builder extends MetadataFieldMapper.Builder<Builder, SeqNoFieldMapper> {
|
||||
public static class Builder extends MetadataFieldMapper.Builder<Builder> {
|
||||
|
||||
public Builder() {
|
||||
super(SeqNoDefaults.NAME, SeqNoDefaults.FIELD_TYPE, SeqNoDefaults.FIELD_TYPE);
|
||||
|
@ -120,7 +120,7 @@ public class SeqNoFieldMapper extends MetadataFieldMapper {
|
|||
|
||||
public static class TypeParser implements MetadataFieldMapper.TypeParser {
|
||||
@Override
|
||||
public MetadataFieldMapper.Builder<?, ?> parse(String name, Map<String, Object> node, ParserContext parserContext)
|
||||
public MetadataFieldMapper.Builder<?> parse(String name, Map<String, Object> node, ParserContext parserContext)
|
||||
throws MapperParsingException {
|
||||
throw new MapperParsingException(NAME + " is not configurable");
|
||||
}
|
||||
|
|
|
@ -74,7 +74,7 @@ public class SourceFieldMapper extends MetadataFieldMapper {
|
|||
|
||||
}
|
||||
|
||||
public static class Builder extends MetadataFieldMapper.Builder<Builder, SourceFieldMapper> {
|
||||
public static class Builder extends MetadataFieldMapper.Builder<Builder> {
|
||||
|
||||
private boolean enabled = Defaults.ENABLED;
|
||||
|
||||
|
@ -108,7 +108,7 @@ public class SourceFieldMapper extends MetadataFieldMapper {
|
|||
|
||||
public static class TypeParser implements MetadataFieldMapper.TypeParser {
|
||||
@Override
|
||||
public MetadataFieldMapper.Builder<?,?> parse(String name, Map<String, Object> node,
|
||||
public MetadataFieldMapper.Builder<?> parse(String name, Map<String, Object> node,
|
||||
ParserContext parserContext) throws MapperParsingException {
|
||||
Builder builder = new Builder();
|
||||
|
||||
|
|
|
@ -110,7 +110,7 @@ public class TextFieldMapper extends FieldMapper {
|
|||
public static final int POSITION_INCREMENT_GAP = 100;
|
||||
}
|
||||
|
||||
public static class Builder extends FieldMapper.Builder<Builder, TextFieldMapper> {
|
||||
public static class Builder extends FieldMapper.Builder<Builder> {
|
||||
|
||||
private int positionIncrementGap = POSITION_INCREMENT_GAP_USE_ANALYZER;
|
||||
private int minPrefixChars = -1;
|
||||
|
|
|
@ -83,7 +83,7 @@ public class TypeFieldMapper extends MetadataFieldMapper {
|
|||
|
||||
public static class TypeParser implements MetadataFieldMapper.TypeParser {
|
||||
@Override
|
||||
public MetadataFieldMapper.Builder<?,?> parse(String name, Map<String, Object> node,
|
||||
public MetadataFieldMapper.Builder<?> parse(String name, Map<String, Object> node,
|
||||
ParserContext parserContext) throws MapperParsingException {
|
||||
throw new MapperParsingException(NAME + " is not configurable");
|
||||
}
|
||||
|
|
|
@ -145,7 +145,7 @@ public class TypeParsers {
|
|||
}
|
||||
}
|
||||
|
||||
public static void parseNorms(FieldMapper.Builder<?,?> builder, String fieldName, Object propNode) {
|
||||
public static void parseNorms(FieldMapper.Builder<?> builder, String fieldName, Object propNode) {
|
||||
builder.omitNorms(XContentMapValues.nodeBooleanValue(propNode, fieldName + ".norms") == false);
|
||||
}
|
||||
|
||||
|
@ -153,7 +153,7 @@ public class TypeParsers {
|
|||
* Parse text field attributes. In addition to {@link #parseField common attributes}
|
||||
* this will parse analysis and term-vectors related settings.
|
||||
*/
|
||||
public static void parseTextField(FieldMapper.Builder<?,?> builder, String name, Map<String, Object> fieldNode,
|
||||
public static void parseTextField(FieldMapper.Builder<?> builder, String name, Map<String, Object> fieldNode,
|
||||
Mapper.TypeParser.ParserContext parserContext) {
|
||||
parseField(builder, name, fieldNode, parserContext);
|
||||
parseAnalyzersAndTermVectors(builder, name, fieldNode, parserContext);
|
||||
|
@ -171,7 +171,7 @@ public class TypeParsers {
|
|||
/**
|
||||
* Parse the {@code meta} key of the mapping.
|
||||
*/
|
||||
public static void parseMeta(FieldMapper.Builder<?,?> builder, String name, Map<String, Object> fieldNode) {
|
||||
public static void parseMeta(FieldMapper.Builder<?> builder, String name, Map<String, Object> fieldNode) {
|
||||
Object metaObject = fieldNode.remove("meta");
|
||||
if (metaObject == null) {
|
||||
// no meta
|
||||
|
@ -217,7 +217,7 @@ public class TypeParsers {
|
|||
/**
|
||||
* Parse common field attributes such as {@code doc_values} or {@code store}.
|
||||
*/
|
||||
public static void parseField(FieldMapper.Builder<?,?> builder, String name, Map<String, Object> fieldNode,
|
||||
public static void parseField(FieldMapper.Builder<?> builder, String name, Map<String, Object> fieldNode,
|
||||
Mapper.TypeParser.ParserContext parserContext) {
|
||||
parseMeta(builder, name, fieldNode);
|
||||
for (Iterator<Map.Entry<String, Object>> iterator = fieldNode.entrySet().iterator(); iterator.hasNext();) {
|
||||
|
|
|
@ -56,7 +56,7 @@ public class VersionFieldMapper extends MetadataFieldMapper {
|
|||
|
||||
public static class TypeParser implements MetadataFieldMapper.TypeParser {
|
||||
@Override
|
||||
public MetadataFieldMapper.Builder<?, ?> parse(String name, Map<String, Object> node,
|
||||
public MetadataFieldMapper.Builder<?> parse(String name, Map<String, Object> node,
|
||||
ParserContext parserContext) throws MapperParsingException {
|
||||
throw new MapperParsingException(NAME + " is not configurable");
|
||||
}
|
||||
|
|
|
@ -57,7 +57,7 @@ public class ExternalMapper extends FieldMapper {
|
|||
public static final String FIELD_SHAPE = "shape";
|
||||
}
|
||||
|
||||
public static class Builder extends FieldMapper.Builder<Builder, ExternalMapper> {
|
||||
public static class Builder extends FieldMapper.Builder<Builder> {
|
||||
|
||||
private BinaryFieldMapper.Builder binBuilder = new BinaryFieldMapper.Builder(Names.FIELD_BIN);
|
||||
private BooleanFieldMapper.Builder boolBuilder = new BooleanFieldMapper.Builder(Names.FIELD_BOOL);
|
||||
|
@ -86,7 +86,7 @@ public class ExternalMapper extends FieldMapper {
|
|||
context.path().add(name);
|
||||
BinaryFieldMapper binMapper = binBuilder.build(context);
|
||||
BooleanFieldMapper boolMapper = boolBuilder.build(context);
|
||||
GeoPointFieldMapper pointMapper = latLonPointBuilder.build(context);
|
||||
GeoPointFieldMapper pointMapper = (GeoPointFieldMapper) latLonPointBuilder.build(context);
|
||||
AbstractShapeGeometryFieldMapper shapeMapper = (context.indexCreatedVersion().before(Version.V_6_6_0))
|
||||
? legacyShapeBuilder.build(context)
|
||||
: shapeBuilder.build(context);
|
||||
|
|
|
@ -74,7 +74,7 @@ public class ExternalMetadataMapper extends MetadataFieldMapper {
|
|||
context.doc().add(new StringField(FIELD_NAME, FIELD_VALUE, Store.YES));
|
||||
}
|
||||
|
||||
public static class Builder extends MetadataFieldMapper.Builder<Builder, ExternalMetadataMapper> {
|
||||
public static class Builder extends MetadataFieldMapper.Builder<Builder> {
|
||||
|
||||
protected Builder() {
|
||||
super(FIELD_NAME, FIELD_TYPE, FIELD_TYPE);
|
||||
|
@ -90,7 +90,7 @@ public class ExternalMetadataMapper extends MetadataFieldMapper {
|
|||
public static class TypeParser implements MetadataFieldMapper.TypeParser {
|
||||
|
||||
@Override
|
||||
public MetadataFieldMapper.Builder<?, ?> parse(String name, Map<String, Object> node,
|
||||
public MetadataFieldMapper.Builder<?> parse(String name, Map<String, Object> node,
|
||||
ParserContext parserContext) throws MapperParsingException {
|
||||
return new Builder();
|
||||
}
|
||||
|
|
|
@ -50,7 +50,7 @@ public class FakeStringFieldMapper extends FieldMapper {
|
|||
}
|
||||
}
|
||||
|
||||
public static class Builder extends FieldMapper.Builder<Builder, FakeStringFieldMapper> {
|
||||
public static class Builder extends FieldMapper.Builder<Builder> {
|
||||
|
||||
public Builder(String name) {
|
||||
super(name, Defaults.FIELD_TYPE, Defaults.FIELD_TYPE);
|
||||
|
|
|
@ -214,7 +214,7 @@ public class TypeParsersTests extends ESTestCase {
|
|||
}
|
||||
|
||||
public void testParseMeta() {
|
||||
FieldMapper.Builder<?, ?> builder = new KeywordFieldMapper.Builder("foo");
|
||||
FieldMapper.Builder<?> builder = new KeywordFieldMapper.Builder("foo");
|
||||
Mapper.TypeParser.ParserContext parserContext = new Mapper.TypeParser.ParserContext(null, null, null, null, null);
|
||||
|
||||
{
|
||||
|
|
|
@ -57,7 +57,7 @@ public class IndicesModuleTests extends ESTestCase {
|
|||
|
||||
private static class FakeMapperParser implements Mapper.TypeParser {
|
||||
@Override
|
||||
public Mapper.Builder<?, ?> parse(String name, Map<String, Object> node, ParserContext parserContext)
|
||||
public Mapper.Builder<?> parse(String name, Map<String, Object> node, ParserContext parserContext)
|
||||
throws MapperParsingException {
|
||||
return null;
|
||||
}
|
||||
|
@ -65,7 +65,7 @@ public class IndicesModuleTests extends ESTestCase {
|
|||
|
||||
private static class FakeMetadataMapperParser implements MetadataFieldMapper.TypeParser {
|
||||
@Override
|
||||
public MetadataFieldMapper.Builder<?, ?> parse(String name, Map<String, Object> node, ParserContext parserContext)
|
||||
public MetadataFieldMapper.Builder<?> parse(String name, Map<String, Object> node, ParserContext parserContext)
|
||||
throws MapperParsingException {
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -86,7 +86,7 @@ public class HistogramFieldMapper extends FieldMapper {
|
|||
public static final ParseField COUNTS_FIELD = new ParseField("counts");
|
||||
public static final ParseField VALUES_FIELD = new ParseField("values");
|
||||
|
||||
public static class Builder extends FieldMapper.Builder<Builder, HistogramFieldMapper> {
|
||||
public static class Builder extends FieldMapper.Builder<Builder> {
|
||||
protected Boolean ignoreMalformed;
|
||||
|
||||
public Builder(String name) {
|
||||
|
@ -126,8 +126,7 @@ public class HistogramFieldMapper extends FieldMapper {
|
|||
|
||||
public static class TypeParser implements Mapper.TypeParser {
|
||||
@Override
|
||||
public Mapper.Builder<Builder, HistogramFieldMapper> parse(String name,
|
||||
Map<String, Object> node, ParserContext parserContext)
|
||||
public Mapper.Builder<Builder> parse(String name, Map<String, Object> node, ParserContext parserContext)
|
||||
throws MapperParsingException {
|
||||
Builder builder = new HistogramFieldMapper.Builder(name);
|
||||
TypeParsers.parseMeta(builder, name, node);
|
||||
|
|
|
@ -60,7 +60,7 @@ public class ConstantKeywordFieldMapper extends FieldMapper {
|
|||
}
|
||||
}
|
||||
|
||||
public static class Builder extends FieldMapper.Builder<Builder, ConstantKeywordFieldMapper> {
|
||||
public static class Builder extends FieldMapper.Builder<Builder> {
|
||||
|
||||
public Builder(String name) {
|
||||
super(name, Defaults.FIELD_TYPE, Defaults.FIELD_TYPE);
|
||||
|
@ -88,7 +88,7 @@ public class ConstantKeywordFieldMapper extends FieldMapper {
|
|||
|
||||
public static class TypeParser implements Mapper.TypeParser {
|
||||
@Override
|
||||
public Mapper.Builder<?,?> parse(String name, Map<String, Object> node, ParserContext parserContext) throws MapperParsingException {
|
||||
public Mapper.Builder<?> parse(String name, Map<String, Object> node, ParserContext parserContext) throws MapperParsingException {
|
||||
Object value = null;
|
||||
if (node.containsKey("value")) {
|
||||
value = node.remove("value");
|
||||
|
|
|
@ -109,7 +109,7 @@ public final class FlatObjectFieldMapper extends DynamicKeyFieldMapper {
|
|||
public static final int IGNORE_ABOVE = Integer.MAX_VALUE;
|
||||
}
|
||||
|
||||
public static class Builder extends FieldMapper.Builder<Builder, FlatObjectFieldMapper> {
|
||||
public static class Builder extends FieldMapper.Builder<Builder> {
|
||||
private int depthLimit = Defaults.DEPTH_LIMIT;
|
||||
private int ignoreAbove = Defaults.IGNORE_ABOVE;
|
||||
|
||||
|
@ -160,7 +160,7 @@ public final class FlatObjectFieldMapper extends DynamicKeyFieldMapper {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Builder addMultiField(Mapper.Builder<?, ?> mapperBuilder) {
|
||||
public Builder addMultiField(Mapper.Builder<?> mapperBuilder) {
|
||||
throw new UnsupportedOperationException("[fields] is not supported for [" + CONTENT_TYPE + "] fields.");
|
||||
}
|
||||
|
||||
|
@ -188,7 +188,7 @@ public final class FlatObjectFieldMapper extends DynamicKeyFieldMapper {
|
|||
|
||||
public static class TypeParser implements Mapper.TypeParser {
|
||||
@Override
|
||||
public Mapper.Builder<?,?> parse(String name, Map<String, Object> node, ParserContext parserContext) throws MapperParsingException {
|
||||
public Mapper.Builder<?> parse(String name, Map<String, Object> node, ParserContext parserContext) throws MapperParsingException {
|
||||
Builder builder = new Builder(name);
|
||||
parseField(builder, name, node, parserContext);
|
||||
for (Iterator<Map.Entry<String, Object>> iterator = node.entrySet().iterator(); iterator.hasNext();) {
|
||||
|
|
|
@ -65,7 +65,7 @@ public class GeoShapeWithDocValuesFieldMapper extends GeoShapeFieldMapper {
|
|||
|
||||
@SuppressWarnings("rawtypes")
|
||||
public static class Builder extends AbstractShapeGeometryFieldMapper.Builder<AbstractShapeGeometryFieldMapper.Builder,
|
||||
GeoShapeWithDocValuesFieldMapper, GeoShapeWithDocValuesFieldType> {
|
||||
GeoShapeWithDocValuesFieldType> {
|
||||
public Builder(String name) {
|
||||
super (name, new GeoShapeWithDocValuesFieldType(), new GeoShapeWithDocValuesFieldType());
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ public class PointFieldMapper extends AbstractPointGeometryFieldMapper<List<? ex
|
|||
implements ArrayValueMapperParser {
|
||||
public static final String CONTENT_TYPE = "point";
|
||||
|
||||
public static class Builder extends AbstractPointGeometryFieldMapper.Builder<Builder, PointFieldMapper, PointFieldType> {
|
||||
public static class Builder extends AbstractPointGeometryFieldMapper.Builder<Builder, PointFieldType> {
|
||||
public Builder(String name) {
|
||||
super(name, new PointFieldType(), new PointFieldType());
|
||||
builder = this;
|
||||
|
|
|
@ -45,7 +45,7 @@ public class ShapeFieldMapper extends AbstractShapeGeometryFieldMapper<Geometry,
|
|||
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
public static class Builder extends AbstractShapeGeometryFieldMapper.Builder<AbstractShapeGeometryFieldMapper.Builder,
|
||||
ShapeFieldMapper, ShapeFieldType> {
|
||||
ShapeFieldType> {
|
||||
|
||||
public Builder(String name) {
|
||||
super(name, Defaults.FIELD_TYPE, Defaults.FIELD_TYPE);
|
||||
|
|
|
@ -58,7 +58,7 @@ public class DenseVectorFieldMapper extends FieldMapper implements ArrayValueMap
|
|||
}
|
||||
}
|
||||
|
||||
public static class Builder extends FieldMapper.Builder<Builder, DenseVectorFieldMapper> {
|
||||
public static class Builder extends FieldMapper.Builder<Builder> {
|
||||
private int dims = 0;
|
||||
|
||||
public Builder(String name) {
|
||||
|
@ -97,7 +97,7 @@ public class DenseVectorFieldMapper extends FieldMapper implements ArrayValueMap
|
|||
|
||||
public static class TypeParser implements Mapper.TypeParser {
|
||||
@Override
|
||||
public Mapper.Builder<?,?> parse(String name, Map<String, Object> node, ParserContext parserContext) throws MapperParsingException {
|
||||
public Mapper.Builder<?> parse(String name, Map<String, Object> node, ParserContext parserContext) throws MapperParsingException {
|
||||
DenseVectorFieldMapper.Builder builder = new DenseVectorFieldMapper.Builder(name);
|
||||
Object dimsField = node.remove("dims");
|
||||
if (dimsField == null) {
|
||||
|
|
|
@ -57,7 +57,7 @@ public class SparseVectorFieldMapper extends FieldMapper {
|
|||
}
|
||||
}
|
||||
|
||||
public static class Builder extends FieldMapper.Builder<Builder, SparseVectorFieldMapper> {
|
||||
public static class Builder extends FieldMapper.Builder<Builder> {
|
||||
|
||||
public Builder(String name) {
|
||||
super(name, Defaults.FIELD_TYPE, Defaults.FIELD_TYPE);
|
||||
|
@ -80,7 +80,7 @@ public class SparseVectorFieldMapper extends FieldMapper {
|
|||
|
||||
public static class TypeParser implements Mapper.TypeParser {
|
||||
@Override
|
||||
public Mapper.Builder<?,?> parse(String name, Map<String, Object> node, ParserContext parserContext) throws MapperParsingException {
|
||||
public Mapper.Builder<?> parse(String name, Map<String, Object> node, ParserContext parserContext) throws MapperParsingException {
|
||||
deprecationLogger.deprecatedAndMaybeLog("sparse_vector", DEPRECATION_MESSAGE);
|
||||
SparseVectorFieldMapper.Builder builder = new SparseVectorFieldMapper.Builder(name);
|
||||
return builder;
|
||||
|
|
|
@ -100,7 +100,7 @@ public class WildcardFieldMapper extends FieldMapper {
|
|||
public static final int IGNORE_ABOVE = Integer.MAX_VALUE;
|
||||
}
|
||||
|
||||
public static class Builder extends FieldMapper.Builder<Builder, WildcardFieldMapper> {
|
||||
public static class Builder extends FieldMapper.Builder<Builder> {
|
||||
protected int ignoreAbove = Defaults.IGNORE_ABOVE;
|
||||
|
||||
|
||||
|
@ -179,7 +179,7 @@ public class WildcardFieldMapper extends FieldMapper {
|
|||
|
||||
public static class TypeParser implements Mapper.TypeParser {
|
||||
@Override
|
||||
public Mapper.Builder<?, ?> parse(String name, Map<String, Object> node, ParserContext parserContext)
|
||||
public Mapper.Builder<?> parse(String name, Map<String, Object> node, ParserContext parserContext)
|
||||
throws MapperParsingException {
|
||||
WildcardFieldMapper.Builder builder = new WildcardFieldMapper.Builder(name);
|
||||
parseField(builder, name, node, parserContext);
|
||||
|
|
Loading…
Reference in New Issue