@Override
public final void onFullDefinitionDeclared(
final Mutable<DeviateKind, DeviateStatement, DeviateEffectiveStatement> deviateStmtCtx) {
- final DeviateKind deviateKind = deviateStmtCtx.getStatementArgument();
+ final DeviateKind deviateKind = deviateStmtCtx.argument();
getSubstatementValidatorForDeviate(deviateKind).validate(deviateStmtCtx);
final SchemaNodeIdentifier deviationTarget =
- (SchemaNodeIdentifier) deviateStmtCtx.coerceParentContext().getStatementArgument();
+ (SchemaNodeIdentifier) deviateStmtCtx.coerceParentContext().argument();
if (!isDeviationSupported(deviateStmtCtx, deviationTarget)) {
return;
@Override
protected final DeviateStatement createDeclared(final StmtContext<DeviateKind, DeviateStatement, ?> ctx,
final ImmutableList<? extends DeclaredStatement<?>> substatements) {
- return new DeviateStatementImpl(ctx.getRawArgument(), ctx.coerceStatementArgument(), substatements);
+ return new DeviateStatementImpl(ctx.getRawArgument(), ctx.getArgument(), substatements);
}
@Override
stmtCtxToBeAdded.sourceReference(),
"Deviation cannot add substatement %s to target node %s because it is already defined "
+ "in target and can appear only once.",
- stmtToBeAdded.getStatementName(), targetCtx.getStatementArgument());
+ stmtToBeAdded.getStatementName(), targetCtx.argument());
}
}
}
&& YangStmtMapping.LEAF_LIST.equals(targetCtx.publicDefinition())) {
LOG.error("Deviation cannot replace substatement {} in target leaf-list {} because a leaf-list can "
+ "have multiple default statements. At line: {}", stmtToBeReplaced.getStatementName(),
- targetCtx.getStatementArgument(), stmtCtxToBeReplaced.sourceReference());
+ targetCtx.argument(), stmtCtxToBeReplaced.sourceReference());
return;
}
throw new InferenceException(stmtCtxToBeReplaced.sourceReference(), "Deviation cannot replace "
+ "substatement %s in target node %s because it does not exist in target node.",
- stmtToBeReplaced.getStatementName(), targetCtx.getStatementArgument());
+ stmtToBeReplaced.getStatementName(), targetCtx.argument());
}
@SuppressFBWarnings(value = "UPM_UNCALLED_PRIVATE_METHOD",
LOG.error("Deviation cannot delete substatement {} with argument '{}' in target node {} because it does "
+ "not exist in the target node. At line: {}", stmtToBeDeleted.getStatementName(), stmtArgument,
- targetCtx.getStatementArgument(), stmtCtxToBeDeleted.sourceReference());
+ targetCtx.argument(), stmtCtxToBeDeleted.sourceReference());
}
private static void copyStatement(final Mutable<?, ?, ?> stmtCtxToBeCopied,
// we need to make a copy of the statement context only if it is an unknown statement, otherwise
// we can reuse the original statement context
if (!StmtContextUtils.isUnknownStatement(stmtCtxToBeCopied)) {
- targetCtx.addEffectiveSubstatement(stmtCtxToBeCopied);
+ targetCtx.addEffectiveSubstatement(stmtCtxToBeCopied.replicaAsChildOf(targetCtx));
} else {
targetCtx.addEffectiveSubstatement(targetCtx.childCopyOf(stmtCtxToBeCopied, CopyType.ORIGINAL));
}
private static void validateDeviationTarget(final StmtContext<?, ?, ?> deviateSubStmtCtx,
final StmtContext<?, ?, ?> targetCtx) {
InferenceException.throwIf(!isSupportedDeviationTarget(deviateSubStmtCtx, targetCtx,
- targetCtx.getRootVersion()), deviateSubStmtCtx.sourceReference(),
+ targetCtx.yangVersion()), deviateSubStmtCtx.sourceReference(),
"%s is not a valid deviation target for substatement %s.", targetCtx.argument(),
deviateSubStmtCtx.publicDefinition().getStatementName());
}
private static boolean isSupportedDeviationTarget(final StmtContext<?, ?, ?> deviateSubstatementCtx,
final StmtContext<?, ?, ?> deviateTargetCtx, final YangVersion yangVersion) {
Set<StatementDefinition> supportedDeviationTargets =
- YangValidationBundles.SUPPORTED_DEVIATION_TARGETS.get(deviateTargetCtx.getRootVersion(),
+ YangValidationBundles.SUPPORTED_DEVIATION_TARGETS.get(yangVersion,
deviateSubstatementCtx.publicDefinition());
if (supportedDeviationTargets == null) {