Class DeclarationInTextSource
- java.lang.Object
-
- org.opendaylight.yangtools.yang.parser.spi.source.DeclarationInTextSource
-
- All Implemented Interfaces:
StatementSourceReference
public abstract class DeclarationInTextSource extends Object implements StatementSourceReference
Reference of statement source present in textual source format. Utility implementation ofStatementSourceReference
for textual sources, this is preferredStatementSourceReference
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.atLine(String, int)
- provides source and line of statement location.inSource(String)
- least specific reference, should be used only if any of previous references are unable to create / derive from source.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static @NonNull DeclarationInTextSource
atLine(String sourceName, int line)
static @NonNull DeclarationInTextSource
atPosition(String sourceName, int line, int position)
boolean
equals(Object obj)
String
getSourceName()
StatementSource
getStatementSource()
Returns source type.int
hashCode()
static @NonNull DeclarationInTextSource
inSource(String sourceName)
String
toString()
Returns human readable representation of statement source.
-
-
-
Method Detail
-
inSource
public static @NonNull DeclarationInTextSource inSource(String sourceName)
-
atLine
public static @NonNull DeclarationInTextSource atLine(String sourceName, int line)
-
atPosition
public static @NonNull DeclarationInTextSource atPosition(String sourceName, int line, int position)
-
getSourceName
public final String getSourceName()
-
getStatementSource
public final StatementSource getStatementSource()
Description copied from interface:StatementSourceReference
Returns source type.- Specified by:
getStatementSource
in interfaceStatementSourceReference
- Returns:
StatementSource.DECLARATION
if statement was explicitly declared in YANG model source,StatementSource.CONTEXT
if statement was inferred.
-
toString
public String toString()
Description copied from interface: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 interfaceStatementSourceReference
- Overrides:
toString
in classObject
- Returns:
- human readable representation of statement source.
-
-