- private static final CharMatcher IDENTIFIER_PREDICATE =
- CharMatcher.noneOf(ParserConstants.RFC3986_RESERVED_CHARACTERS).precomputed();
- private static final CharMatcher PERCENT_ENCODING = CharMatcher.is('%');
- // position of the first encoded char after percent sign in percent encoded string
- private static final int FIRST_ENCODED_CHAR = 1;
- // position of the last encoded char after percent sign in percent encoded string
- private static final int LAST_ENCODED_CHAR = 3;
- // percent encoded radix for parsing integers
- private static final int PERCENT_ENCODED_RADIX = 16;
-
- private final EffectiveModelContext schemaContext;
- private final String data;
-
- private DataSchemaContextNode<?> current;
- private int offset;
-
- private YangInstanceIdentifierDeserializer(final EffectiveModelContext schemaContext, final String data) {
+ public static final class Result {
+ public final @NonNull YangInstanceIdentifier path;
+ public final @NonNull SchemaInferenceStack stack;
+ public final @NonNull SchemaNode node;
+
+ Result(final EffectiveModelContext context) {
+ path = YangInstanceIdentifier.empty();
+ node = requireNonNull(context);
+ stack = SchemaInferenceStack.of(context);
+ }
+
+ Result(final EffectiveModelContext context, final QName qname) {
+ // Legacy behavior: RPCs do not really have a YangInstanceIdentifier, but the rest of the code expects it
+ path = YangInstanceIdentifier.of(qname);
+ stack = SchemaInferenceStack.of(context);
+
+ final var stmt = stack.enterSchemaTree(qname);
+ verify(stmt instanceof RpcDefinition, "Unexpected statement %s", stmt);
+ node = (RpcDefinition) stmt;
+ }
+
+ Result(final List<PathArgument> steps, final SchemaInferenceStack stack, final SchemaNode node) {
+ path = YangInstanceIdentifier.create(steps);
+ this.stack = requireNonNull(stack);
+ this.node = requireNonNull(node);
+ }
+ }
+
+ private final @NonNull EffectiveModelContext schemaContext;
+ private final @NonNull ApiPath apiPath;
+
+ private YangInstanceIdentifierDeserializer(final EffectiveModelContext schemaContext, final ApiPath apiPath) {