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 class
An argument composed of multiple concatenated parts.static class
An argument composed of a single string. -
Method Summary
Modifier and TypeMethodDescriptionstatic @NonNull IRArgument.Single
doubleQuoted
(String string) static @NonNull IRArgument.Single
empty()
abstract boolean
abstract int
hashCode()
static @NonNull IRArgument.Single
identifier
(String string) static @NonNull IRArgument
of
(List<IRArgument.Single> parts) static @NonNull IRArgument.Single
singleQuoted
(String string) final String
toString()
static @NonNull IRArgument.Single