package org.opendaylight.restconf.nb.rfc8040;
import com.google.common.collect.ImmutableList;
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import java.text.ParseException;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.restconf.nb.rfc8040.ApiPath.ApiIdentifier;
-import org.opendaylight.restconf.nb.rfc8040.FieldsParameter.NodeSelector;
+import org.opendaylight.restconf.nb.rfc8040.FieldsParam.NodeSelector;
import org.opendaylight.yangtools.yang.common.YangNames;
/**
- * Stateful parser for {@link FieldsParameter}. This is not as hard as IETF's ABNF would lead you to believe. The
- * original definition is:
+ * Stateful parser for {@link FieldsParam}. This is not as hard as IETF's ABNF would lead you to believe. The original
+ * definition is:
* <pre>
* fields-expr = path "(" fields-expr ")" / path ";" fields-expr / path
* path = api-identifier [ "/" path ]
* </pre>
*
* <p>
- * That ANTLR4 grammar dictates the layout of {@link FieldsParameter}. It also shows the parsing is recursive on
+ * That ANTLR4 grammar dictates the layout of {@link FieldsParam}. It also shows the parsing is recursive on
* {@code node-selectors}, which is what {@link #parse(String)} and
* {@link NodeSelectorParser#parseSubSelectors(String, int)} deal with.
*/
// parsers instead of ten.
private Deque<NodeSelectorParser> parsers;
- @NonNull FieldsParameter parse(final String str) throws ParseException {
+ @NonNull FieldsParam parse(final String str) throws ParseException {
final var nodeSelectors = ImmutableList.<NodeSelector>builder();
int idx = 0;
if (next == str.length()) {
// We have reached the end, we are done
- return new FieldsParameter(nodeSelectors.build());
+ return new FieldsParam(nodeSelectors.build());
}
final char ch = str.charAt(next);
}
}
- @SuppressFBWarnings(value = "UPM_UNCALLED_PRIVATE_METHOD",
- justification = "https://github.com/spotbugs/spotbugs/issues/811")
private @NonNull NodeSelectorParser getParser() {
final var local = parsers;
if (local != null) {
return new NodeSelectorParser();
}
- @SuppressFBWarnings(value = "UPM_UNCALLED_PRIVATE_METHOD",
- justification = "https://github.com/spotbugs/spotbugs/issues/811")
private void putParser(final NodeSelectorParser parser) {
var local = parsers;
if (local == null) {
local.push(parser);
}
- @SuppressFBWarnings(value = "UPM_UNCALLED_PRIVATE_METHOD",
- justification = "https://github.com/spotbugs/spotbugs/issues/811")
private static void expectIdentifierStart(final String str, final int offset) throws ParseException {
final char ch = charAt(str, offset);
if (!YangNames.IDENTIFIER_START.matches(ch)) {
}
}
- @SuppressFBWarnings(value = "UPM_UNCALLED_PRIVATE_METHOD",
- justification = "https://github.com/spotbugs/spotbugs/issues/811")
private static char charAt(final String str, final int offset) throws ParseException {
if (str.length() == offset) {
throw new ParseException("Unexpected end of input", offset);