Class ExplicitStatement
java.lang.Object
org.opendaylight.yangtools.yang.parser.spi.source.StatementSourceReference
org.opendaylight.yangtools.yang.parser.spi.source.ExplicitStatement
- All Implemented Interfaces:
Immutable
,DeclarationReference
@Beta
public abstract class ExplicitStatement
extends StatementSourceReference
implements DeclarationReference
Reference of statement source present in textual source format. Utility implementation
of
StatementSourceReference
for textual sources, this is preferred StatementSourceReference
for implementations of YANG / YIN statement stream sources.
To create source reference use one of this static factories:
atPosition(String, int, int)
- provides most specific reference of statement location, this is most preferred since it provides most context to debug YANG model.atPosition(int, int)
- provides location in text without knowing the name of the text file.inFile(String)
- provides a source name.
-
Method Summary
Modifier and TypeMethodDescriptionstatic @NonNull ExplicitStatement
atPosition
(int line, int column) static @NonNull ExplicitStatement
atPosition
(@Nullable String fileName, int line, int column) final DeclarationReference
Returns theDeclarationReference
associated with this reference, if available.final boolean
final int
hashCode()
static @NonNull ExplicitStatement
final StatementOrigin
Returns theStatementOrigin
associated with this reference.final String
Returns human readable representation of this reference.final String
toString()
Returns human readable representation of statement source.
-
Method Details
-
atPosition
-
atPosition
public static @NonNull ExplicitStatement atPosition(@Nullable String fileName, int line, int column) -
inFile
-
statementOrigin
Description copied from class:StatementSourceReference
Returns theStatementOrigin
associated with this reference.- Specified by:
statementOrigin
in classStatementSourceReference
- Returns:
StatementOrigin.DECLARATION
if statement was explicitly declared in YANG model source,StatementOrigin.CONTEXT
if statement was inferred.
-
declarationReference
Description copied from class:StatementSourceReference
Returns theDeclarationReference
associated with this reference, if available.- Specified by:
declarationReference
in classStatementSourceReference
- Returns:
- A
DeclarationReference
or null.
-
toHumanReadable
Description copied from interface:DeclarationReference
Returns human readable representation of this reference. This method does not prescribe any format of the returned string.- Specified by:
toHumanReadable
in interfaceDeclarationReference
- Returns:
- human readable representation of this reference.
-
hashCode
public final int hashCode() -
equals
-
toString
Description copied from class:StatementSourceReference
Returns human readable representation of statement source.Implementations of this interface should override
StatementSourceReference.toString()
, since it may be used in error reporting to provide context information for model designer to debug errors in its mode.- Specified by:
toString
in classStatementSourceReference
- Returns:
- human readable representation of statement source.
-