Interface SourceRepresentation

All Superinterfaces:
Immutable
All Known Subinterfaces:
YangSourceRepresentation, YinSourceRepresentation, YinXmlSource
All Known Implementing Classes:
DelegatedYangTextSource, DelegatedYinTextSource, FileYangTextSource, FileYinTextSource, StringYangTextSource, URLYangTextSource, URLYinTextSource, YangIRSource, YangTextSource, YinDomSource, YinTextSource

public sealed interface SourceRepresentation extends Immutable permits YangSourceRepresentation, YinSourceRepresentation
Common interface for schema source representations. A schema source is an atomic piece of the overall schema context. In YANG terms, a schema source is semantically equivalent to a single YANG text file, be it a module or a submodule.

A schema source can exist in various forms, which we call representations. Again, in YANG terms, each representation is semantically equivalent, but from implementation perspective certain operations on a schema source may require it to be first transformed into a particular representation before they can be applied. Such transformations are affected via instances of SchemaSourceTransformation.

Typical examples of a schema source representation include:

  • a String - textual representation of source code
  • a InputStream - input stream containing source code
  • a ByteSource - source for input streams containing source code
  • Parsed abstract syntax tree (AST), which is the result of a syntactic parser

Implementations of this interface expected to comply with the Immutable contract.

  • Method Details

    • sourceId

      @NonNull SourceIdentifier sourceId()
      The SourceIdentifier of this source.
      Returns:
      SourceIdentifier of this source
    • getType

      @NonNull Class<? extends SourceRepresentation> getType()
      Return the concrete representation type.
      Returns:
      The type of representation.
    • symbolicName

      @Nullable String symbolicName()
      Return the symbolic name, if available. This name has no semantic meaning beyond being useful for debugging by humans.
      Returns:
      Symbolic name, if available