Class StmtContextUtils
java.lang.Object
org.opendaylight.yangtools.yang.parser.spi.meta.StmtContextUtils
-
Method Summary
Modifier and TypeMethodDescriptionstatic booleancheckFeatureSupport(StmtContext<?, ?, ?> stmtContext, Set<QName> supportedFeatures) static <A,D extends org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement<A>>
Collection<StmtContext<A,D, ?>> findAllDeclaredSubstatements(StmtContext<?, ?, ?> stmtContext, Class<D> declaredType) static <A,D extends org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement<A>>
Collection<StmtContext<A,D, ?>> findAllEffectiveSubstatements(StmtContext<?, ?, ?> stmtContext, Class<D> type) static <A,D extends org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement<A>>
Collection<StmtContext<A,D, ?>> findAllSubstatements(StmtContext<?, ?, ?> stmtContext, Class<D> type) static <D extends org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement<?>>
StmtContext<?,?, ?> findDeepFirstDeclaredSubstatement(StmtContext<?, ?, ?> stmtContext, Class<? super D> declaredType) static StmtContext<?,?, ?> findFirstDeclaredSubstatement(StmtContext<?, ?, ?> stmtContext, int startIndex, Class<? extends org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement<?>>... types) static <A,D extends org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement<A>>
StmtContext<A,?, ?> findFirstDeclaredSubstatement(StmtContext<?, ?, ?> stmtContext, Class<D> declaredType) static <D extends org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement<?>>
StmtContext<?,?, ?> findFirstDeclaredSubstatementOnSublevel(StmtContext<?, ?, ?> stmtContext, Class<? super D> declaredType, int sublevel) static <A,D extends org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement<A>>
StmtContext<A,?, ?> findFirstEffectiveSubstatement(StmtContext<?, ?, ?> stmtContext, Class<D> declaredType) static <A,D extends org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement<A>>
AfirstAttributeOf(Iterable<? extends StmtContext<?, ?, ?>> contexts, Class<D> declaredType) static <A,D extends org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement<A>>
AfirstAttributeOf(StmtContext<?, ?, ?> ctx, Class<D> declaredType) static <A,D extends org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement<A>>
AfirstSubstatementAttributeOf(StmtContext<?, ?, ?> ctx, Class<D> declaredType) getLatestRevision(Iterable<? extends StmtContext<?, ?, ?>> subStmts) static QNameModulegetModuleQNameByPrefix(StmtContext<?, ?, ?> ctx, String prefix) static QNameModulegetRootModuleQName(StmtContext<?, ?, ?> ctx) static booleanhasAncestorOfType(StmtContext<?, ?, ?> stmt, Collection<org.opendaylight.yangtools.yang.model.api.meta.StatementDefinition> ancestorTypes) Checks whether at least one ancestor of a StatementContext matches one from a collection of statement definitions.static booleanhasParentOfType(StmtContext<?, ?, ?> ctx, org.opendaylight.yangtools.yang.model.api.meta.StatementDefinition parentType) Checks whether the parent of StmtContext is of specified type.static booleanisInExtensionBody(StmtContext<?, ?, ?> stmtCtx) static booleanisMandatoryNode(StmtContext<?, ?, ?> stmtCtx) Checks whether statement context is a mandatory leaf, choice, anyxml, list or leaf-list according to RFC6020 or not.static booleanisNonPresenceContainer(StmtContext<?, ?, ?> stmtCtx) Checks whether statement context is a non-presence container or not.static booleanisNotMandatoryNodeOfType(StmtContext<?, ?, ?> stmtCtx, org.opendaylight.yangtools.yang.model.api.meta.StatementDefinition stmtDef) Checks whether a statement context is a statement of supplied statement definition and whether it is not mandatory leaf, choice, anyxml, list or leaf-list according to RFC6020.static booleanisPresenceContainer(StmtContext<?, ?, ?> stmtCtx) Checks whether statement context is a presence container or not.static booleanisUnknownStatement(StmtContext<?, ?, ?> stmtCtx) Returns true if supplied statement context represents unknown statement, otherwise returns false.static @NonNull QNameparseIdentifier(StmtContext<?, ?, ?> ctx, String str) Parse a YANG identifier string in context of a statement.static @NonNull QNameparseNodeIdentifier(StmtContext<?, ?, ?> ctx, String str) Parse a YANG node identifier string in context of a statement.static @NonNull QNameparseNodeIdentifier(StmtContext<?, ?, ?> ctx, String prefix, String localName) static @NonNull QNameqnameFromArgument(StmtContext<?, ?, ?> ctx, String value) static voidvalidateIfFeatureAndWhenOnListKeys(StmtContext<?, ?, ?> ctx) Validates the specified statement context with regards to if-feature and when statement on list keys.static voidvalidateNoKeylessListAncestorOf(StmtContext.Mutable<?, ?, ?> stmt, String name) Check whether all of StmtContext'slistancestors have akey.
-
Method Details
-
firstAttributeOf
public static <A,D extends org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement<A>> A firstAttributeOf(Iterable<? extends StmtContext<?, ?, ?>> contexts, Class<D> declaredType) -
firstAttributeOf
public static <A,D extends org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement<A>> A firstAttributeOf(StmtContext<?, ?, ?> ctx, Class<D> declaredType) -
firstSubstatementAttributeOf
public static <A,D extends org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement<A>> A firstSubstatementAttributeOf(StmtContext<?, ?, ?> ctx, Class<D> declaredType) -
findFirstDeclaredSubstatement
public static <A,D extends org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement<A>> StmtContext<A,?, findFirstDeclaredSubstatement?> (StmtContext<?, ?, ?> stmtContext, Class<D> declaredType) -
findFirstDeclaredSubstatement
@SafeVarargs public static StmtContext<?,?, findFirstDeclaredSubstatement?> (StmtContext<?, ?, ?> stmtContext, int startIndex, Class<? extends org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement<?>>... types) -
findAllDeclaredSubstatements
public static <A,D extends org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement<A>> Collection<StmtContext<A,D, findAllDeclaredSubstatements?>> (StmtContext<?, ?, ?> stmtContext, Class<D> declaredType) -
findAllEffectiveSubstatements
public static <A,D extends org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement<A>> Collection<StmtContext<A,D, findAllEffectiveSubstatements?>> (StmtContext<?, ?, ?> stmtContext, Class<D> type) -
findAllSubstatements
public static <A,D extends org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement<A>> Collection<StmtContext<A,D, findAllSubstatements?>> (StmtContext<?, ?, ?> stmtContext, Class<D> type) -
findFirstEffectiveSubstatement
public static <A,D extends org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement<A>> StmtContext<A,?, findFirstEffectiveSubstatement?> (StmtContext<?, ?, ?> stmtContext, Class<D> declaredType) -
findFirstDeclaredSubstatementOnSublevel
public static <D extends org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement<?>> StmtContext<?,?, findFirstDeclaredSubstatementOnSublevel?> (StmtContext<?, ?, ?> stmtContext, Class<? super D> declaredType, int sublevel) -
findDeepFirstDeclaredSubstatement
public static <D extends org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement<?>> StmtContext<?,?, findDeepFirstDeclaredSubstatement?> (StmtContext<?, ?, ?> stmtContext, Class<? super D> declaredType) -
isInExtensionBody
-
isUnknownStatement
Returns true if supplied statement context represents unknown statement, otherwise returns false.- Parameters:
stmtCtx- statement context to be checked- Returns:
- true if supplied statement context represents unknown statement, otherwise false
- Throws:
NullPointerException- if supplied statement context is null
-
checkFeatureSupport
public static boolean checkFeatureSupport(StmtContext<?, ?, ?> stmtContext, Set<QName> supportedFeatures) -
isPresenceContainer
Checks whether statement context is a presence container or not.- Parameters:
stmtCtx- statement context- Returns:
- true if it is a presence container
-
isNonPresenceContainer
Checks whether statement context is a non-presence container or not.- Parameters:
stmtCtx- statement context- Returns:
- true if it is a non-presence container
-
isMandatoryNode
Checks whether statement context is a mandatory leaf, choice, anyxml, list or leaf-list according to RFC6020 or not.- Parameters:
stmtCtx- statement context- Returns:
- true if it is a mandatory leaf, choice, anyxml, list or leaf-list according to RFC6020.
-
isNotMandatoryNodeOfType
public static boolean isNotMandatoryNodeOfType(StmtContext<?, ?, ?> stmtCtx, org.opendaylight.yangtools.yang.model.api.meta.StatementDefinition stmtDef) Checks whether a statement context is a statement of supplied statement definition and whether it is not mandatory leaf, choice, anyxml, list or leaf-list according to RFC6020.- Parameters:
stmtCtx- statement contextstmtDef- statement definition- Returns:
- true if supplied statement context is a statement of supplied statement definition and if it is not mandatory leaf, choice, anyxml, list or leaf-list according to RFC6020
-
hasAncestorOfType
public static boolean hasAncestorOfType(StmtContext<?, ?, ?> stmt, Collection<org.opendaylight.yangtools.yang.model.api.meta.StatementDefinition> ancestorTypes) Checks whether at least one ancestor of a StatementContext matches one from a collection of statement definitions.- Parameters:
stmt- Statement context to be checkedancestorTypes- collection of statement definitions- Returns:
- true if at least one ancestor of a StatementContext matches one from collection of statement definitions, otherwise false.
-
validateNoKeylessListAncestorOf
Check whether all of StmtContext'slistancestors have akey.- Parameters:
stmt- EffectiveStmtCtx to be checkedname- Human-friendly statement name- Throws:
SourceException- if there is any keyless list ancestor
-
hasParentOfType
public static boolean hasParentOfType(StmtContext<?, ?, ?> ctx, org.opendaylight.yangtools.yang.model.api.meta.StatementDefinition parentType) Checks whether the parent of StmtContext is of specified type.- Parameters:
ctx- StmtContext to be checkedparentType- type of parent to check- Returns:
- true if the parent of StmtContext is of specified type, otherwise false
-
validateIfFeatureAndWhenOnListKeys
Validates the specified statement context with regards to if-feature and when statement on list keys. The context can either be a leaf which is defined directly in the substatements of a keyed list or a uses statement defined in a keyed list (a uses statement may add leaves into the list).If one of the list keys contains an if-feature or a when statement in YANG 1.1 model, an exception is thrown.
- Parameters:
ctx- statement context to be validated
-
qnameFromArgument
-
parseIdentifier
Parse a YANG identifier string in context of a statement.- Parameters:
ctx- Statement contextstr- String to be parsed- Returns:
- An interned QName
- Throws:
NullPointerException- if any of the arguments are nullSourceException- if the string is not a valid YANG identifier
-
parseNodeIdentifier
public static @NonNull QName parseNodeIdentifier(StmtContext<?, ?, ?> ctx, String prefix, String localName) -
parseNodeIdentifier
Parse a YANG node identifier string in context of a statement.- Parameters:
ctx- Statement contextstr- String to be parsed- Returns:
- An interned QName
- Throws:
NullPointerException- if any of the arguments are nullSourceException- if the string is not a valid YANG node identifier
-
getRootModuleQName
-
getModuleQNameByPrefix
-
getLatestRevision
-