import static com.google.common.base.Verify.verify;
import com.google.common.collect.Collections2;
-import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import java.net.URI;
import java.util.Collection;
import org.opendaylight.yangtools.yang.model.api.NotificationDefinition;
import org.opendaylight.yangtools.yang.model.api.RevisionAwareXPath;
import org.opendaylight.yangtools.yang.model.api.SchemaPath;
-import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.AugmentEffectiveStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.AugmentStatement;
ActionNodeContainerCompat<SchemaNodeIdentifier, AugmentStatement>,
NotificationNodeContainerCompat<SchemaNodeIdentifier, AugmentStatement> {
private final SchemaPath targetPath;
- private final URI namespace;
- private final Revision revision;
+ private final QNameModule rootModuleQName;
private final @NonNull ImmutableSet<ActionDefinition> actions;
private final @NonNull ImmutableSet<NotificationDefinition> notifications;
private final RevisionAwareXPath whenCondition;
AugmentEffectiveStatementImpl(final StmtContext<SchemaNodeIdentifier, AugmentStatement,
EffectiveStatement<SchemaNodeIdentifier, AugmentStatement>> ctx) {
super(ctx);
-
- this.targetPath = ctx.coerceStatementArgument().asSchemaPath();
-
- final QNameModule rootModuleQName = StmtContextUtils.getRootModuleQName(ctx);
- this.namespace = rootModuleQName.getNamespace();
- this.revision = rootModuleQName.getRevision().orElse(null);
-
- this.copyOf = (AugmentationSchemaNode) ctx.getOriginalCtx().map(StmtContext::buildEffective).orElse(null);
+ targetPath = ctx.coerceStatementArgument().asSchemaPath();
+ rootModuleQName = StmtContextUtils.getRootModuleQName(ctx);
+ copyOf = (AugmentationSchemaNode) ctx.getOriginalCtx().map(StmtContext::buildEffective).orElse(null);
whenCondition = findFirstEffectiveSubstatementArgument(WhenEffectiveStatement.class).orElse(null);
// initSubstatementCollections
final ImmutableSet.Builder<ActionDefinition> actionsBuilder = ImmutableSet.builder();
final ImmutableSet.Builder<NotificationDefinition> notificationsBuilder = ImmutableSet.builder();
- final ImmutableList.Builder<UnknownSchemaNode> listBuilder = new ImmutableList.Builder<>();
for (final EffectiveStatement<?, ?> effectiveStatement : effectiveSubstatements()) {
if (effectiveStatement instanceof ActionDefinition) {
actionsBuilder.add((ActionDefinition) effectiveStatement);
}
}
- this.actions = actionsBuilder.build();
- this.notifications = notificationsBuilder.build();
+ actions = actionsBuilder.build();
+ notifications = notificationsBuilder.build();
}
@Override
@Override
public URI getNamespace() {
- return namespace;
+ return rootModuleQName.getNamespace();
+ }
+
+ @Override
+ public Optional<Revision> getRevision() {
+ return rootModuleQName.getRevision();
}
@Override
return notifications;
}
- @Override
- public Optional<Revision> getRevision() {
- return Optional.ofNullable(revision);
- }
-
@Override
public int hashCode() {
final int prime = 17;