public final class StmtContextUtils extends Object
Modifier and Type | Field and Description |
---|---|
static com.google.common.base.Splitter |
LIST_KEY_SPLITTER |
Modifier and Type | Method and Description |
---|---|
static boolean |
checkFeatureSupport(StmtContext<?,?,?> stmtContext,
Set<QName> supportedFeatures) |
static SourceIdentifier |
createSourceIdentifier(StmtContext<?,?,?> root) |
static <AT,DT extends DeclaredStatement<AT>> |
findAllDeclaredSubstatements(StmtContext<?,?,?> stmtContext,
Class<DT> declaredType) |
static <AT,DT extends DeclaredStatement<AT>> |
findAllEffectiveSubstatements(StmtContext<?,?,?> stmtContext,
Class<DT> type) |
static <AT,DT extends DeclaredStatement<AT>> |
findAllSubstatements(StmtContext<?,?,?> stmtContext,
Class<DT> type) |
static <DT extends DeclaredStatement<?>> |
findDeepFirstDeclaredSubstatement(StmtContext<?,?,?> stmtContext,
Class<DT> declaredType) |
static <AT,DT extends DeclaredStatement<AT>> |
findFirstDeclaredSubstatement(StmtContext<?,?,?> stmtContext,
Class<DT> declaredType) |
static StmtContext<?,?,?> |
findFirstDeclaredSubstatement(StmtContext<?,?,?> stmtContext,
int startIndex,
Class<? extends DeclaredStatement<?>>... types) |
static <DT extends DeclaredStatement<?>> |
findFirstDeclaredSubstatementOnSublevel(StmtContext<?,?,?> stmtContext,
Class<DT> declaredType,
int sublevel) |
static <AT,DT extends DeclaredStatement<AT>> |
findFirstEffectiveSubstatement(StmtContext<?,?,?> stmtContext,
Class<DT> declaredType) |
static <AT,DT extends DeclaredStatement<AT>> |
findFirstSubstatement(StmtContext<?,?,?> stmtContext,
Class<DT> declaredType)
Searches for the first substatement of the specified type in the specified statement context.
|
static <AT,DT extends DeclaredStatement<AT>> |
firstAttributeOf(Iterable<? extends StmtContext<?,?,?>> contexts,
Class<DT> declaredType) |
static <AT,DT extends DeclaredStatement<AT>> |
firstAttributeOf(StmtContext<?,?,?> ctx,
Class<DT> declaredType) |
static <AT,DT extends DeclaredStatement<AT>> |
firstSubstatementAttributeOf(StmtContext<?,?,?> ctx,
Class<DT> declaredType) |
static Date |
getLatestRevision(Iterable<? extends StmtContext<?,?,?>> subStmts) |
static QNameModule |
getModuleQNameByPrefix(StmtContext<?,?,?> ctx,
String prefix) |
static QNameModule |
getRootModuleQName(StmtContext<?,?,?> ctx) |
static boolean |
hasAncestorOfType(StmtContext<?,?,?> ctx,
Collection<StatementDefinition> ancestorTypes)
Checks whether at least one ancestor of a StatementContext matches one
from collection of statement definitions.
|
static <AT,DT extends DeclaredStatement<AT>> |
hasAncestorOfTypeWithChildOfType(StmtContext<?,?,?> ctx,
StatementDefinition ancestorType,
StatementDefinition ancestorChildType)
Checks whether all of StmtContext's ancestors of specified type have a child of specified type
|
static boolean |
hasParentOfType(StmtContext<?,?,?> ctx,
StatementDefinition parentType)
Checks whether the parent of StmtContext is of specified type
|
static boolean |
isInExtensionBody(StmtContext<?,?,?> stmtCtx) |
static boolean |
isMandatoryNode(StmtContext<?,?,?> stmtCtx)
Checks whether statement context is a mandatory leaf, choice, anyxml,
list or leaf-list according to RFC6020 or not.
|
static boolean |
isNonPresenceContainer(StmtContext<?,?,?> stmtCtx)
Checks whether statement context is a non-presence container or not.
|
static boolean |
isNotMandatoryNodeOfType(StmtContext<?,?,?> stmtCtx,
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 boolean |
isPresenceContainer(StmtContext<?,?,?> stmtCtx)
Checks whether statement context is a presence container or not.
|
static boolean |
isUnknownStatement(StmtContext<?,?,?> stmtCtx)
Returns true if supplied statement context represents unknown statement,
otherwise returns false.
|
static boolean |
isUnrecognizedStatement(StmtContext<?,?,?> stmtCtx)
Returns true if supplied statement context represents unrecognized
statement, otherwise returns false.
|
static boolean |
producesDeclared(StmtContext<?,?,?> ctx,
Class<? extends DeclaredStatement<?>> type) |
static QName |
qnameFromArgument(StmtContext<?,?,?> ctx,
String value) |
static Collection<SchemaNodeIdentifier> |
replaceModuleQNameForKey(StmtContext<Collection<SchemaNodeIdentifier>,KeyStatement,?> keyStmtCtx,
QNameModule newQNameModule) |
static void |
validateIfFeatureAndWhenOnListKeys(StmtContext<?,?,?> ctx)
Validates the specified statement context with regards to if-feature and when statement on list keys.
|
public static final com.google.common.base.Splitter LIST_KEY_SPLITTER
public static <AT,DT extends DeclaredStatement<AT>> AT firstAttributeOf(Iterable<? extends StmtContext<?,?,?>> contexts, Class<DT> declaredType)
public static <AT,DT extends DeclaredStatement<AT>> AT firstAttributeOf(StmtContext<?,?,?> ctx, Class<DT> declaredType)
public static <AT,DT extends DeclaredStatement<AT>> AT firstSubstatementAttributeOf(StmtContext<?,?,?> ctx, Class<DT> declaredType)
public static <AT,DT extends DeclaredStatement<AT>> StmtContext<AT,?,?> findFirstDeclaredSubstatement(StmtContext<?,?,?> stmtContext, Class<DT> declaredType)
public static <AT,DT extends DeclaredStatement<AT>> Collection<StmtContext<AT,DT,?>> findAllDeclaredSubstatements(StmtContext<?,?,?> stmtContext, Class<DT> declaredType)
public static <AT,DT extends DeclaredStatement<AT>> Collection<StmtContext<AT,DT,?>> findAllEffectiveSubstatements(StmtContext<?,?,?> stmtContext, Class<DT> type)
public static <AT,DT extends DeclaredStatement<AT>> Collection<StmtContext<AT,DT,?>> findAllSubstatements(StmtContext<?,?,?> stmtContext, Class<DT> type)
public static <AT,DT extends DeclaredStatement<AT>> StmtContext<AT,?,?> findFirstEffectiveSubstatement(StmtContext<?,?,?> stmtContext, Class<DT> declaredType)
public static <AT,DT extends DeclaredStatement<AT>> StmtContext<AT,?,?> findFirstSubstatement(StmtContext<?,?,?> stmtContext, Class<DT> declaredType)
AT
- statement argument typeDT
- declared statement typestmtContext
- statement context to search indeclaredType
- substatement type to search for@SafeVarargs public static StmtContext<?,?,?> findFirstDeclaredSubstatement(StmtContext<?,?,?> stmtContext, int startIndex, Class<? extends DeclaredStatement<?>>... types)
public static <DT extends DeclaredStatement<?>> StmtContext<?,?,?> findFirstDeclaredSubstatementOnSublevel(StmtContext<?,?,?> stmtContext, Class<DT> declaredType, int sublevel)
public static <DT extends DeclaredStatement<?>> StmtContext<?,?,?> findDeepFirstDeclaredSubstatement(StmtContext<?,?,?> stmtContext, Class<DT> declaredType)
public static boolean producesDeclared(StmtContext<?,?,?> ctx, Class<? extends DeclaredStatement<?>> type)
public static boolean isInExtensionBody(StmtContext<?,?,?> stmtCtx)
public static boolean isUnknownStatement(StmtContext<?,?,?> stmtCtx)
stmtCtx
- statement context to be checkedNullPointerException
- if supplied statement context is nullpublic static boolean isUnrecognizedStatement(StmtContext<?,?,?> stmtCtx)
stmtCtx
- statement context to be checkedNullPointerException
- if supplied statement context is nullpublic static Collection<SchemaNodeIdentifier> replaceModuleQNameForKey(StmtContext<Collection<SchemaNodeIdentifier>,KeyStatement,?> keyStmtCtx, QNameModule newQNameModule)
public static boolean checkFeatureSupport(StmtContext<?,?,?> stmtContext, Set<QName> supportedFeatures)
public static boolean isPresenceContainer(StmtContext<?,?,?> stmtCtx)
stmtCtx
- statement contextpublic static boolean isNonPresenceContainer(StmtContext<?,?,?> stmtCtx)
stmtCtx
- statement contextpublic static boolean isMandatoryNode(StmtContext<?,?,?> stmtCtx)
stmtCtx
- statement contextpublic static boolean isNotMandatoryNodeOfType(StmtContext<?,?,?> stmtCtx, StatementDefinition stmtDef)
stmtCtx
- statement contextstmtDef
- statement definitionpublic static boolean hasAncestorOfType(StmtContext<?,?,?> ctx, Collection<StatementDefinition> ancestorTypes)
ctx
- StatementContext to be checkedancestorTypes
- collection of statement definitionspublic static <AT,DT extends DeclaredStatement<AT>> boolean hasAncestorOfTypeWithChildOfType(StmtContext<?,?,?> ctx, StatementDefinition ancestorType, StatementDefinition ancestorChildType)
ctx
- StmtContext to be checkedancestorType
- type of ancestor to search forancestorChildType
- type of child to search for in the specified ancestor typepublic static boolean hasParentOfType(StmtContext<?,?,?> ctx, StatementDefinition parentType)
ctx
- StmtContext to be checkedparentType
- type of parent to checkpublic static void validateIfFeatureAndWhenOnListKeys(StmtContext<?,?,?> ctx)
ctx
- statement context to be validatedpublic static QName qnameFromArgument(StmtContext<?,?,?> ctx, String value)
public static QNameModule getRootModuleQName(StmtContext<?,?,?> ctx)
public static QNameModule getModuleQNameByPrefix(StmtContext<?,?,?> ctx, String prefix)
public static SourceIdentifier createSourceIdentifier(StmtContext<?,?,?> root)
public static Date getLatestRevision(Iterable<? extends StmtContext<?,?,?>> subStmts)
Copyright © 2018 OpenDaylight. All rights reserved.