Class IRArgument
java.lang.Object
org.opendaylight.yangtools.yang.ir.IRArgument
- All Implemented Interfaces:
Immutable
- Direct Known Subclasses:
IRArgument.Concatenation,IRArgument.Single
@Beta
public abstract sealed class IRArgument
extends Object
permits IRArgument.Single, IRArgument.Concatenation
An argument to a YANG statement, as defined by section 6.1.3 of both
RFC6020 and
RFC7950. An argument is effectively any old string,
except it can be defined in a number of ways:
- it can be a simple unquoted string, or
- it can be a single-quoted string, with its contents being completely preserved, or
- it can be a double-quoted string, which defines some escaping and whitespace-stripping rules, or
- it can be a concatenation of any number of single- or double-quoted strings
The first three cases as covered by IRArgument.Single subclass, which exposes appropriate methods to infer how its
string literal is to be interpreted. The last case is handled by IRArgument.Concatenation subclass, which exposes
the constituent parts as IRArgument.Single items.
Please note that parser implementations producing these argument representations are NOT required to retain the format of the original definition. They are free to perform quoting and concatenation transformations as long as they maintain semantic equivalence. As a matter of example, these transformations are explicitly allowed:
- elimination of unneeded quotes, for example turning
"foo"intofoo - transformation of quotes, for example turning
"foo\nbar"into'foo
bar' - concatenation processing, for example turning
'foo' + 'bar'intofoobar
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classAn argument composed of multiple concatenated parts.static classAn argument composed of a single string. -
Method Summary
Modifier and TypeMethodDescriptionstatic @NonNull IRArgument.SingledoubleQuoted(String string) static @NonNull IRArgument.Singleempty()abstract booleanabstract inthashCode()static @NonNull IRArgument.Singleidentifier(String string) static @NonNull IRArgumentof(List<IRArgument.Single> parts) static @NonNull IRArgument.SinglesingleQuoted(String string) final StringtoString()static @NonNull IRArgument.Single