@Override public FieldMapper updateFieldType(Map<String, MappedFieldType> fullNameToFieldType) { ExternalMapper update = (ExternalMapper) super.updateFieldType(fullNameToFieldType); MultiFields multiFieldsUpdate = multiFields.updateFieldType(fullNameToFieldType); BinaryFieldMapper binMapperUpdate = (BinaryFieldMapper) binMapper.updateFieldType(fullNameToFieldType); BooleanFieldMapper boolMapperUpdate = (BooleanFieldMapper) boolMapper.updateFieldType(fullNameToFieldType); BaseGeoPointFieldMapper pointMapperUpdate = (BaseGeoPointFieldMapper) pointMapper.updateFieldType(fullNameToFieldType); GeoShapeFieldMapper shapeMapperUpdate = (GeoShapeFieldMapper) shapeMapper.updateFieldType(fullNameToFieldType); TextFieldMapper stringMapperUpdate = (TextFieldMapper) stringMapper.updateFieldType(fullNameToFieldType); if (update == this && multiFieldsUpdate == multiFields && binMapperUpdate == binMapper && boolMapperUpdate == boolMapper && pointMapperUpdate == pointMapper && shapeMapperUpdate == shapeMapper && stringMapperUpdate == stringMapper) { return this; } if (update == this) { update = (ExternalMapper) clone(); } update.multiFields = multiFieldsUpdate; update.binMapper = binMapperUpdate; update.boolMapper = boolMapperUpdate; update.pointMapper = pointMapperUpdate; update.shapeMapper = shapeMapperUpdate; update.stringMapper = stringMapperUpdate; return update; }
@Override public Mapper parse(ParseContext context) throws IOException { byte[] bytes = "Hello world".getBytes(Charset.defaultCharset()); binMapper.parse(context.createExternalValueContext(bytes)); boolMapper.parse(context.createExternalValueContext(true)); // Let's add a Dummy Point Double lat = 42.0; Double lng = 51.0; GeoPoint point = new GeoPoint(lat, lng); pointMapper.parse(context.createExternalValueContext(point)); // Let's add a Dummy Shape Point shape = ShapeBuilders.newPoint(-100, 45).build(); shapeMapper.parse(context.createExternalValueContext(shape)); context = context.createExternalValueContext(generatedValue); // Let's add a Original String stringMapper.parse(context); multiFields.parse(this, context); return null; }