Skip to content

Commit

Permalink
Move diff manifest to new class and fix fromXContent
Browse files Browse the repository at this point in the history
Signed-off-by: Shivansh Arora <[email protected]>
  • Loading branch information
shiv0408 committed May 17, 2024
1 parent 4c33720 commit 3186372
Show file tree
Hide file tree
Showing 5 changed files with 483 additions and 379 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@
import org.opensearch.core.xcontent.XContentParser.Token;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import java.util.function.Consumer;

Expand Down Expand Up @@ -178,4 +180,14 @@ public static <T> void parseTypedKeysObject(XContentParser parser, String delimi
throw new ParsingException(parser.getTokenLocation(), "Failed to parse object: empty key");
}
}

public static List<String> parseStringList(XContentParser parser) throws IOException {
List<String> valueList = new ArrayList<>();
ensureExpectedToken(Token.START_ARRAY, parser.currentToken(), parser);
while (parser.nextToken() != Token.END_ARRAY) {
ensureExpectedToken(Token.VALUE_STRING, parser.currentToken(), parser);
valueList.add(parser.text());
}
return valueList;
}
}
Loading

0 comments on commit 3186372

Please sign in to comment.