Remove unused mapStringsOrdered method (#42513) (#43585)

This commit is contained in:
Przemysław Witek 2019-06-25 20:43:38 +02:00 committed by GitHub
parent 173338ad37
commit 76a750a0a0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 3 additions and 30 deletions

View File

@ -136,11 +136,9 @@ public interface XContentParser extends Closeable {
Map<String, String> mapStrings() throws IOException; Map<String, String> mapStrings() throws IOException;
Map<String, String> mapStringsOrdered() throws IOException;
/** /**
* Returns an instance of {@link Map} holding parsed map. * Returns an instance of {@link Map} holding parsed map.
* Serves as a replacement for the "map", "mapOrdered", "mapStrings" and "mapStringsOrdered" methods above. * Serves as a replacement for the "map", "mapOrdered" and "mapStrings" methods above.
* *
* @param mapFactory factory for creating new {@link Map} objects * @param mapFactory factory for creating new {@link Map} objects
* @param mapValueParser parser for parsing a single map value * @param mapValueParser parser for parsing a single map value

View File

@ -108,11 +108,6 @@ public class XContentSubParser implements XContentParser {
return parser.mapStrings(); return parser.mapStrings();
} }
@Override
public Map<String, String> mapStringsOrdered() throws IOException {
return parser.mapStringsOrdered();
}
@Override @Override
public <T> Map<String, T> map( public <T> Map<String, T> map(
Supplier<Map<String, T>> mapFactory, CheckedFunction<XContentParser, T, IOException> mapValueParser) throws IOException { Supplier<Map<String, T>> mapFactory, CheckedFunction<XContentParser, T, IOException> mapValueParser) throws IOException {

View File

@ -276,11 +276,6 @@ public abstract class AbstractXContentParser implements XContentParser {
return readMapStrings(this); return readMapStrings(this);
} }
@Override
public Map<String, String> mapStringsOrdered() throws IOException {
return readOrderedMapStrings(this);
}
@Override @Override
public <T> Map<String, T> map( public <T> Map<String, T> map(
Supplier<Map<String, T>> mapFactory, CheckedFunction<XContentParser, T, IOException> mapValueParser) throws IOException { Supplier<Map<String, T>> mapFactory, CheckedFunction<XContentParser, T, IOException> mapValueParser) throws IOException {
@ -303,8 +298,6 @@ public abstract class AbstractXContentParser implements XContentParser {
static final Supplier<Map<String, String>> SIMPLE_MAP_STRINGS_FACTORY = HashMap::new; static final Supplier<Map<String, String>> SIMPLE_MAP_STRINGS_FACTORY = HashMap::new;
static final Supplier<Map<String, String>> ORDERED_MAP_STRINGS_FACTORY = LinkedHashMap::new;
static Map<String, Object> readMap(XContentParser parser) throws IOException { static Map<String, Object> readMap(XContentParser parser) throws IOException {
return readMap(parser, SIMPLE_MAP_FACTORY); return readMap(parser, SIMPLE_MAP_FACTORY);
} }
@ -314,11 +307,7 @@ public abstract class AbstractXContentParser implements XContentParser {
} }
static Map<String, String> readMapStrings(XContentParser parser) throws IOException { static Map<String, String> readMapStrings(XContentParser parser) throws IOException {
return readMapStrings(parser, SIMPLE_MAP_STRINGS_FACTORY); return readGenericMap(parser, SIMPLE_MAP_STRINGS_FACTORY, XContentParser::text);
}
static Map<String, String> readOrderedMapStrings(XContentParser parser) throws IOException {
return readMapStrings(parser, ORDERED_MAP_STRINGS_FACTORY);
} }
static List<Object> readList(XContentParser parser) throws IOException { static List<Object> readList(XContentParser parser) throws IOException {
@ -333,10 +322,6 @@ public abstract class AbstractXContentParser implements XContentParser {
return readGenericMap(parser, mapFactory, p -> readValue(p, mapFactory)); return readGenericMap(parser, mapFactory, p -> readValue(p, mapFactory));
} }
static Map<String, String> readMapStrings(XContentParser parser, Supplier<Map<String, String>> mapFactory) throws IOException {
return readGenericMap(parser, mapFactory, XContentParser::text);
}
static <T> Map<String, T> readGenericMap( static <T> Map<String, T> readGenericMap(
XContentParser parser, XContentParser parser,
Supplier<Map<String, T>> mapFactory, Supplier<Map<String, T>> mapFactory,

View File

@ -189,7 +189,7 @@ public class XContentParserTests extends ESTestCase {
assertThat(parser.currentName(), equalTo("foo")); assertThat(parser.currentName(), equalTo("foo"));
token = parser.nextToken(); token = parser.nextToken();
assertThat(token, equalTo(XContentParser.Token.START_OBJECT)); assertThat(token, equalTo(XContentParser.Token.START_OBJECT));
return randomBoolean() ? parser.mapStringsOrdered() : parser.mapStrings(); return parser.mapStrings();
} }
} }

View File

@ -120,11 +120,6 @@ public class WatcherXContentParser implements XContentParser {
return parser.mapStrings(); return parser.mapStrings();
} }
@Override
public Map<String, String> mapStringsOrdered() throws IOException {
return parser.mapStringsOrdered();
}
@Override @Override
public <T> Map<String, T> map( public <T> Map<String, T> map(
Supplier<Map<String, T>> mapFactory, CheckedFunction<XContentParser, T, IOException> mapValueParser) throws IOException { Supplier<Map<String, T>> mapFactory, CheckedFunction<XContentParser, T, IOException> mapValueParser) throws IOException {