Class IRKeyword

java.lang.Object
org.opendaylight.yangtools.yang.ir.IRKeyword
All Implemented Interfaces:
Immutable
Direct Known Subclasses:
IRKeyword.Qualified, IRKeyword.Unqualified

@Beta public abstract sealed class IRKeyword extends Object permits IRKeyword.Qualified, IRKeyword.Unqualified
A YANG keyword, as defined, as defined by section 6.1.2 of both RFC6020 and RFC7950. The two options are discerned by nullability of prefix() method's return, as hinted by the ABNF for node-identifier -- and while a keyword is a semantically different construct, it shares the same value space.

Naming in this class prefers the formal ABNF specification and draws value-space and type-safety implications from that connection, rather than following the RFC-assigned names.

  • Method Details

    • identifier

      public final @NonNull String identifier()
      This keyword's 'identifier' part. This corresponds to what the RFCs refer to as YANG keyword or as language extension keyword.

      Note the returned string is guaranteed to conform to rules of identifier ABNF..

      Returns:
      This keyword's identifier part.
    • prefix

      public abstract @Nullable String prefix()
      This keyword's 'prefix' part. This corresponds to prefix identifier. For YANG keywords this is null. For language extension references this is the non-null prefix which references the YANG module defining the language extension.

      Note the returned string, if non-null, is guaranteed to conform to rules of identifier ABNF.

      Returns:
      This keyword's prefix, or null if this keyword references a YANG keyword.
    • asStringDeclaration

      public abstract @NonNull String asStringDeclaration()
      Helper method to re-create the string which was used to declared this keyword.
      Returns:
      Declaration string.
    • hashCode

      public final int hashCode()
    • equals

      public final boolean equals(Object obj)
    • toString

      public final String toString()
      Overrides:
      toString in class Object