Another batch, bringing the number of violation to under 800.
Change-Id: I2d39b73747c952f07f633822d46f79326f9355e0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
* bundle of supported verions
*/
public CustomStatementParserBuilder(final Set<YangVersion> supportedVersions) {
- reactorSupportBundles = ImmutableMap.<ModelProcessingPhase, StatementSupportBundle.Builder> builder()
+ reactorSupportBundles = ImmutableMap.<ModelProcessingPhase, StatementSupportBundle.Builder>builder()
.put(ModelProcessingPhase.INIT, StatementSupportBundle.builder(supportedVersions))
.put(ModelProcessingPhase.SOURCE_PRE_LINKAGE, StatementSupportBundle.builder(supportedVersions))
.put(ModelProcessingPhase.SOURCE_LINKAGE, StatementSupportBundle.builder(supportedVersions))
final class SimpleNamespaceContext<K, V, N extends IdentifierNamespace<K, V>>
extends NamespaceBehaviourWithListeners<K, V, N> {
- // FIXME: Change this to Multimap, once issue with modules
- // is resolved.
- private final List<NamespaceBehaviourWithListeners.ValueAddedListener<K>> listeners = new ArrayList<>();
- public SimpleNamespaceContext(NamespaceBehaviour<K, V, N> delegate) {
+ // FIXME: Change this to Multimap, once issue with modules is resolved.
+ private final List<ValueAddedListener<K>> listeners = new ArrayList<>();
+
+ SimpleNamespaceContext(final NamespaceBehaviour<K, V, N> delegate) {
super(delegate);
}
- protected boolean isRequestedValue(NamespaceBehaviourWithListeners.ValueAddedListener<K> listener, NamespaceStorageNode storage, V value) {
+ @Override
+ protected boolean isRequestedValue(final ValueAddedListener<K> listener, final NamespaceStorageNode storage,
+ final V value) {
NamespaceStorageNode listenerCtx = listener.getCtxNode();
return value == getFrom(listenerCtx, listener.getKey());
}
@Override
- protected void addListener(K key, NamespaceBehaviourWithListeners.ValueAddedListener<K> listener) {
+ protected void addListener(final K key, final ValueAddedListener<K> listener) {
listeners.add(listener);
}
- private Iterator<NamespaceBehaviourWithListeners.ValueAddedListener<K>> getMutableListeners(K key) {
+ private Iterator<ValueAddedListener<K>> getMutableListeners(final K key) {
return listeners.iterator();
}
notifyListeners(storage, getMutableListeners(key), value);
notifyDerivedNamespaces(storage, key, value);
}
-}
\ No newline at end of file
+}
final class VirtualNamespaceContext<K, V, N extends IdentifierNamespace<K, V>, DK>
extends NamespaceBehaviourWithListeners<K, V, N> {
- private final Multimap<DK, NamespaceBehaviourWithListeners.ValueAddedListener<K>> listeners = HashMultimap.create();
+ private final Multimap<DK, ValueAddedListener<K>> listeners = HashMultimap.create();
private final DerivedNamespaceBehaviour<K, V, DK, N, ?> derivedDelegate;
- public VirtualNamespaceContext(DerivedNamespaceBehaviour<K, V, DK, N, ?> delegate) {
+ VirtualNamespaceContext(final DerivedNamespaceBehaviour<K, V, DK, N, ?> delegate) {
super(delegate);
this.derivedDelegate = delegate;
}
- protected boolean isRequestedValue(NamespaceBehaviourWithListeners.ValueAddedListener<K> listener, NamespaceStorageNode storage, V value) {
+ @Override
+ protected boolean isRequestedValue(final ValueAddedListener<K> listener, final NamespaceStorageNode storage,
+ final V value) {
return value == getFrom(listener.getCtxNode(), listener.getKey());
}
@Override
- protected void addListener(K key, NamespaceBehaviourWithListeners.ValueAddedListener<K> listener) {
+ protected void addListener(final K key, final ValueAddedListener<K> listener) {
listeners.put(derivedDelegate.getSignificantKey(key), listener);
}
-
- void addedToSourceNamespace(NamespaceBehaviour.NamespaceStorageNode storage, DK key, V value) {
+ void addedToSourceNamespace(final NamespaceBehaviour.NamespaceStorageNode storage, final DK key, final V value) {
notifyListeners(storage, listeners.get(key).iterator(), value);
}
notifyListeners(storage, listeners.get(derivedDelegate.getSignificantKey(key)).iterator(), value);
notifyDerivedNamespaces(storage, key, value);
}
-}
\ No newline at end of file
+}
super(context);
}
- public static class Definition extends
- AbstractStatementSupport<String, Decimal64Specification, EffectiveStatement<String, Decimal64Specification>> {
+ public static class Definition extends AbstractStatementSupport<String, Decimal64Specification,
+ EffectiveStatement<String, Decimal64Specification>> {
public Definition() {
super(YangStmtMapping.TYPE);
}
@Override
- public EffectiveStatement<String, Decimal64Specification> createEffective(
- final StmtContext<String, Decimal64Specification, EffectiveStatement<String, Decimal64Specification>> ctx) {
+ public EffectiveStatement<String, Decimal64Specification> createEffective(final StmtContext<String,
+ Decimal64Specification, EffectiveStatement<String, Decimal64Specification>> ctx) {
return new Decimal64SpecificationEffectiveStatementImpl(ctx);
}
public RangeStatement getRange() {
return firstDeclared(RangeStatement.class);
}
-
}
super(context);
}
- public static class Definition extends AbstractStatementSupport<String,DefaultStatement,EffectiveStatement<String,DefaultStatement>> {
+ public static class Definition
+ extends AbstractStatementSupport<String, DefaultStatement, EffectiveStatement<String, DefaultStatement>> {
public Definition() {
super(YangStmtMapping.DEFAULT);
}
}
- @Nonnull @Override
+ @Nonnull
+ @Override
public String getValue() {
return rawArgument();
}
.DESCRIPTION)
.build();
- protected DescriptionStatementImpl(
- final StmtContext<String, DescriptionStatement, ?> context) {
+ protected DescriptionStatementImpl(final StmtContext<String, DescriptionStatement, ?> context) {
super(context);
}
- public static class Definition extends AbstractStatementSupport<String,DescriptionStatement,EffectiveStatement<String,DescriptionStatement>> {
+ public static class Definition extends AbstractStatementSupport<String, DescriptionStatement,
+ EffectiveStatement<String, DescriptionStatement>> {
public Definition() {
super(YangStmtMapping.DESCRIPTION);
}
@Override
- public EffectiveStatement<String, DescriptionStatement> createEffective(final StmtContext<String, DescriptionStatement, EffectiveStatement<String, DescriptionStatement>> ctx) {
+ public EffectiveStatement<String, DescriptionStatement> createEffective(
+ final StmtContext<String, DescriptionStatement, EffectiveStatement<String, DescriptionStatement>> ctx) {
return new DescriptionEffectiveStatementImpl(ctx);
}
}
}
- @Nonnull @Override
+ @Nonnull
+ @Override
public String getText() {
return rawArgument();
}
public static class Definition extends AbstractStatementSupport<DeviateKind, DeviateStatement,
EffectiveStatement<DeviateKind, DeviateStatement>> {
private static final Map<String, DeviateKind> KEYWORD_TO_DEVIATE_MAP;
+
static {
final Builder<String, DeviateKind> keywordToDeviateMapBuilder = ImmutableMap.builder();
for (final DeviateKind deviate : DeviateKind.values()) {
&& YangStmtMapping.LEAF.equals(targetCtx.getPublicDefinition())) {
for (final StmtContext<?, ?, ?> targetCtxSubstatement : targetCtx.allSubstatements()) {
InferenceException.throwIf(stmtToBeAdded.equals(targetCtxSubstatement.getPublicDefinition()),
- stmtCtxToBeAdded.getStatementSourceReference(), "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());
+ stmtCtxToBeAdded.getStatementSourceReference(),
+ "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());
}
}
}
if (YangStmtMapping.DEFAULT.equals(stmtToBeReplaced)
&& YangStmtMapping.LEAF_LIST.equals(targetCtx.getPublicDefinition())) {
- LOG.error("Deviation cannot replace substatement {} in target leaf-list {} because a leaf-list can " +
- "have multiple default statements. At line: {}", stmtToBeReplaced.getStatementName(),
+ 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.getStatementSourceReference());
return;
}
}
}
- throw new InferenceException(stmtCtxToBeReplaced.getStatementSourceReference(), "Deviation cannot " +
- "replace substatement %s in target node %s because it does not exist in target node.",
+ throw new InferenceException(stmtCtxToBeReplaced.getStatementSourceReference(), "Deviation cannot replace "
+ + "substatement %s in target node %s because it does not exist in target node.",
stmtToBeReplaced.getStatementName(), targetCtx.getStatementArgument());
}
}
}
- 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,
+ 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.getStatementSourceReference());
}
}
}
- @Nonnull @Override
+ @Nonnull
+ @Override
public DeviateKind getValue() {
return argument();
}
import org.opendaylight.yangtools.yang.parser.spi.source.ModuleCtxToModuleQName;
import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.DeviationEffectiveStatementImpl;
-public class DeviationStatementImpl extends AbstractDeclaredStatement<SchemaNodeIdentifier> implements DeviationStatement {
+public class DeviationStatementImpl extends AbstractDeclaredStatement<SchemaNodeIdentifier>
+ implements DeviationStatement {
private static final SubstatementValidator SUBSTATEMENT_VALIDATOR = SubstatementValidator.builder(YangStmtMapping
.DEVIATION)
.addOptional(YangStmtMapping.DESCRIPTION)
super(context);
}
- public static class Definition extends AbstractStatementSupport<SchemaNodeIdentifier,DeviationStatement,EffectiveStatement<SchemaNodeIdentifier,DeviationStatement>> {
+ public static class Definition extends AbstractStatementSupport<SchemaNodeIdentifier, DeviationStatement,
+ EffectiveStatement<SchemaNodeIdentifier, DeviationStatement>> {
public Definition() {
super(YangStmtMapping.DEVIATION);
@Override
public EffectiveStatement<SchemaNodeIdentifier, DeviationStatement> createEffective(
- final StmtContext<SchemaNodeIdentifier, DeviationStatement, EffectiveStatement<SchemaNodeIdentifier, DeviationStatement>> ctx) {
+ final StmtContext<SchemaNodeIdentifier, DeviationStatement,
+ EffectiveStatement<SchemaNodeIdentifier, DeviationStatement>> ctx) {
return new DeviationEffectiveStatementImpl(ctx);
}
}
}
- @Nonnull @Override
+ @Nonnull
+ @Override
public SchemaNodeIdentifier getTargetNode() {
return argument();
}
import org.opendaylight.yangtools.yang.model.api.YangStmtMapping;
import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.EnumStatement;
-import org.opendaylight.yangtools.yang.model.api.stmt.TypeStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.TypeStatement.EnumSpecification;
import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractDeclaredStatement;
import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractStatementSupport;
import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
import org.opendaylight.yangtools.yang.parser.spi.meta.SubstatementValidator;
import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.type.EnumSpecificationEffectiveStatementImpl;
-public class EnumSpecificationImpl extends AbstractDeclaredStatement<String> implements TypeStatement.EnumSpecification {
+public class EnumSpecificationImpl extends AbstractDeclaredStatement<String> implements EnumSpecification {
private static final SubstatementValidator SUBSTATEMENT_VALIDATOR = SubstatementValidator.builder(YangStmtMapping
.TYPE)
.addMultiple(YangStmtMapping.ENUM)
.build();
- protected EnumSpecificationImpl(final StmtContext<String, TypeStatement.EnumSpecification, ?> context) {
+ protected EnumSpecificationImpl(final StmtContext<String, EnumSpecification, ?> context) {
super(context);
}
public static class Definition
- extends
- AbstractStatementSupport<String, TypeStatement.EnumSpecification, EffectiveStatement<String, TypeStatement.EnumSpecification>> {
+ extends AbstractStatementSupport<String, EnumSpecification, EffectiveStatement<String, EnumSpecification>> {
public Definition() {
super(YangStmtMapping.TYPE);
}
@Override
- public TypeStatement.EnumSpecification createDeclared(
- final StmtContext<String, TypeStatement.EnumSpecification, ?> ctx) {
+ public EnumSpecification createDeclared(final StmtContext<String, EnumSpecification, ?> ctx) {
return new EnumSpecificationImpl(ctx);
}
@Override
- public EffectiveStatement<String, TypeStatement.EnumSpecification> createEffective(
- final StmtContext<String, TypeStatement.EnumSpecification, EffectiveStatement<String, TypeStatement.EnumSpecification>> ctx) {
+ public EffectiveStatement<String, EnumSpecification> createEffective(
+ final StmtContext<String, EnumSpecification, EffectiveStatement<String, EnumSpecification>> ctx) {
return new EnumSpecificationEffectiveStatementImpl(ctx);
}
public Collection<? extends EnumStatement> getEnums() {
return allDeclared(EnumStatement.class);
}
-
}
.ERROR_MESSAGE)
.build();
- protected ErrorMessageStatementImpl(
- final StmtContext<String, ErrorMessageStatement, ?> context) {
+ protected ErrorMessageStatementImpl(final StmtContext<String, ErrorMessageStatement, ?> context) {
super(context);
}
- public static class Definition
- extends
+ public static class Definition extends
AbstractStatementSupport<String, ErrorMessageStatement, EffectiveStatement<String, ErrorMessageStatement>> {
public Definition() {
}
@Override
- public ErrorMessageStatement createDeclared(
- final StmtContext<String, ErrorMessageStatement, ?> ctx) {
+ public ErrorMessageStatement createDeclared(final StmtContext<String, ErrorMessageStatement, ?> ctx) {
return new ErrorMessageStatementImpl(ctx);
}
@Override
public EffectiveStatement<String, ErrorMessageStatement> createEffective(
- final StmtContext<String, ErrorMessageStatement, EffectiveStatement<String, ErrorMessageStatement>> ctx) {
+ final StmtContext<String, ErrorMessageStatement,
+ EffectiveStatement<String, ErrorMessageStatement>> ctx) {
return new ErrorMessageEffectiveStatementImpl(ctx);
}
import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractQNameStatementSupport;
import org.opendaylight.yangtools.yang.parser.spi.meta.StatementDefinitionNamespace;
import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
+import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext.Mutable;
import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContextUtils;
import org.opendaylight.yangtools.yang.parser.spi.meta.SubstatementValidator;
import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.ExtensionEffectiveStatementImpl;
}
@Override
- public EffectiveStatement<QName,ExtensionStatement> createEffective(
- final StmtContext<QName,ExtensionStatement ,EffectiveStatement<QName,ExtensionStatement>> ctx) {
+ public EffectiveStatement<QName, ExtensionStatement> createEffective(
+ final StmtContext<QName, ExtensionStatement, EffectiveStatement<QName,ExtensionStatement>> ctx) {
return ExtensionEffectiveStatementImpl.create(ctx);
}
@Override
- public void onStatementDefinitionDeclared(final StmtContext.Mutable<QName, ExtensionStatement, EffectiveStatement<QName, ExtensionStatement>> stmt) {
+ public void onStatementDefinitionDeclared(
+ final Mutable<QName, ExtensionStatement, EffectiveStatement<QName, ExtensionStatement>> stmt) {
super.onStatementDefinitionDeclared(stmt);
QName stmtName = stmt.getStatementArgument();
public ArgumentStatement getArgument() {
return firstDeclared(ArgumentStatement.class);
}
-
}
import org.opendaylight.yangtools.yang.parser.spi.meta.SubstatementValidator;
import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.IdentityEffectiveStatementImpl;
-public class IdentityStatementImpl extends AbstractDeclaredStatement<QName>
- implements IdentityStatement {
+public class IdentityStatementImpl extends AbstractDeclaredStatement<QName> implements IdentityStatement {
private static final SubstatementValidator SUBSTATEMENT_VALIDATOR = SubstatementValidator.builder(YangStmtMapping
.IDENTITY)
.addOptional(YangStmtMapping.BASE)
.addOptional(YangStmtMapping.STATUS)
.build();
- protected IdentityStatementImpl(
- final StmtContext<QName, IdentityStatement, ?> context) {
+ protected IdentityStatementImpl(final StmtContext<QName, IdentityStatement, ?> context) {
super(context);
}
}
@Override
- public IdentityStatement createDeclared(
- final StmtContext<QName, IdentityStatement, ?> ctx) {
+ public IdentityStatement createDeclared(final StmtContext<QName, IdentityStatement, ?> ctx) {
return new IdentityStatementImpl(ctx);
}
}
@Override
- public void onStatementDefinitionDeclared(final StmtContext.Mutable<QName, IdentityStatement, EffectiveStatement<QName, IdentityStatement>> stmt) {
+ public void onStatementDefinitionDeclared(final StmtContext.Mutable<QName, IdentityStatement,
+ EffectiveStatement<QName, IdentityStatement>> stmt) {
stmt.addToNs(IdentityNamespace.class, stmt.getStatementArgument(), stmt);
}
public QName getName() {
return argument();
}
-
}
.IF_FEATURE)
.build();
- protected IfFeatureStatementImpl(
- final StmtContext<Predicate<Set<QName>>, IfFeatureStatement, ?> context) {
+ protected IfFeatureStatementImpl(final StmtContext<Predicate<Set<QName>>, IfFeatureStatement, ?> context) {
super(context);
}
- public static class Definition
- extends
- AbstractStatementSupport<Predicate<Set<QName>>, IfFeatureStatement, EffectiveStatement<Predicate<Set<QName>>, IfFeatureStatement>> {
+ public static class Definition extends AbstractStatementSupport<Predicate<Set<QName>>, IfFeatureStatement,
+ EffectiveStatement<Predicate<Set<QName>>, IfFeatureStatement>> {
public Definition() {
super(YangStmtMapping.IF_FEATURE);
@Override
public Predicate<Set<QName>> parseArgumentValue(final StmtContext<?, ?, ?> ctx, final String value) {
- if(YangVersion.VERSION_1_1.equals(ctx.getRootVersion())) {
+ if (YangVersion.VERSION_1_1.equals(ctx.getRootVersion())) {
return parseIfFeatureExpression(ctx, value);
- } else {
- final QName qName = StmtContextUtils.qnameFromArgument(ctx, value);
- return setQNames -> setQNames.contains(qName);
}
+
+ final QName qname = StmtContextUtils.qnameFromArgument(ctx, value);
+ return setQNames -> setQNames.contains(qname);
}
@Override
- public IfFeatureStatement createDeclared(
- final StmtContext<Predicate<Set<QName>>, IfFeatureStatement, ?> ctx) {
+ public IfFeatureStatement createDeclared(final StmtContext<Predicate<Set<QName>>, IfFeatureStatement, ?> ctx) {
return new IfFeatureStatementImpl(ctx);
}
@Override
public EffectiveStatement<Predicate<Set<QName>>, IfFeatureStatement> createEffective(
- final StmtContext<Predicate<Set<QName>>, IfFeatureStatement, EffectiveStatement<Predicate<Set<QName>>, IfFeatureStatement>> ctx) {
+ final StmtContext<Predicate<Set<QName>>, IfFeatureStatement,
+ EffectiveStatement<Predicate<Set<QName>>, IfFeatureStatement>> ctx) {
return new IfFeatureEffectiveStatementImpl(ctx);
}
return SUBSTATEMENT_VALIDATOR;
}
- private static Predicate<Set<QName>> parseIfFeatureExpression(final StmtContext<?, ?, ?> ctx, final String value) {
+ private static Predicate<Set<QName>> parseIfFeatureExpression(final StmtContext<?, ?, ?> ctx,
+ final String value) {
final IfFeatureExpressionLexer lexer = new IfFeatureExpressionLexer(CharStreams.fromString(value));
final CommonTokenStream tokens = new CommonTokenStream(lexer);
final IfFeatureExpressionParser parser = new IfFeatureExpressionParser(tokens);
return new IfFeaturePredicateVisitor(ctx).visit(parser.if_feature_expr());
}
- private static class IfFeaturePredicateVisitor extends IfFeatureExpressionParserBaseVisitor<Predicate<Set<QName>>> {
+ private static class IfFeaturePredicateVisitor
+ extends IfFeatureExpressionParserBaseVisitor<Predicate<Set<QName>>> {
private final StmtContext<?, ?, ?> stmtCtx;
- public IfFeaturePredicateVisitor(final StmtContext<?, ?, ?> ctx) {
+ IfFeaturePredicateVisitor(final StmtContext<?, ?, ?> ctx) {
this.stmtCtx = Preconditions.checkNotNull(ctx);
}
@Override
public Predicate<Set<QName>> visitIf_feature_expr(final If_feature_exprContext ctx) {
- if (ctx.if_feature_expr() != null) {
- return visitIf_feature_term(ctx.if_feature_term()).or(visitIf_feature_expr(ctx.if_feature_expr()));
- } else {
+ if (ctx.if_feature_expr() == null) {
return visitIf_feature_term(ctx.if_feature_term());
}
+
+ return visitIf_feature_term(ctx.if_feature_term()).or(visitIf_feature_expr(ctx.if_feature_expr()));
}
@Override
public Predicate<Set<QName>> visitIf_feature_term(final If_feature_termContext ctx) {
- if (ctx.if_feature_term() != null) {
- return visitIf_feature_factor(ctx.if_feature_factor()).and(visitIf_feature_term(ctx.if_feature_term()));
- } else {
+ if (ctx.if_feature_term() == null) {
return visitIf_feature_factor(ctx.if_feature_factor());
}
+
+ return visitIf_feature_factor(ctx.if_feature_factor()).and(visitIf_feature_term(ctx.if_feature_term()));
}
@Override
import org.opendaylight.yangtools.yang.parser.spi.meta.SemanticVersionModuleNamespace;
import org.opendaylight.yangtools.yang.parser.spi.meta.SemanticVersionNamespace;
import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
-import org.opendaylight.yangtools.yang.parser.spi.meta.SubstatementValidator;
import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext.Mutable;
+import org.opendaylight.yangtools.yang.parser.spi.meta.SubstatementValidator;
import org.opendaylight.yangtools.yang.parser.spi.source.ImpPrefixToModuleIdentifier;
import org.opendaylight.yangtools.yang.parser.spi.source.ImpPrefixToNamespace;
import org.opendaylight.yangtools.yang.parser.spi.source.ImpPrefixToSemVerModuleIdentifier;
}
@Override
- public void onPreLinkageDeclared(final Mutable<String, ImportStatement, EffectiveStatement<String, ImportStatement>> stmt) {
+ public void onPreLinkageDeclared(final Mutable<String, ImportStatement,
+ EffectiveStatement<String, ImportStatement>> stmt) {
/*
* Add ModuleIdentifier of a module which is required by this module.
* Based on this information, required modules are searched from library
StmtContext<?, ?, ?> importedModule = null;
ModuleIdentifier importedModuleIdentifier = null;
if (impIdentifier.getRevision() == SimpleDateFormatUtil.DEFAULT_DATE_IMP) {
- final Entry<ModuleIdentifier, StmtContext<?, ModuleStatement, EffectiveStatement<String, ModuleStatement>>> recentModuleEntry = findRecentModule(
- impIdentifier, stmt.getAllFromNamespace(ModuleNamespace.class));
+ final Entry<ModuleIdentifier, StmtContext<?, ModuleStatement,
+ EffectiveStatement<String, ModuleStatement>>> recentModuleEntry = findRecentModule(
+ impIdentifier, stmt.getAllFromNamespace(ModuleNamespace.class));
if (recentModuleEntry != null) {
importedModuleIdentifier = recentModuleEntry.getKey();
importedModule = recentModuleEntry.getValue();
importedModuleIdentifier = impIdentifier;
}
- linkageTarget.resolve(ctx).addToNs(ImportedModuleContext.class, importedModuleIdentifier, importedModule);
+ linkageTarget.resolve(ctx).addToNs(ImportedModuleContext.class, importedModuleIdentifier,
+ importedModule);
final String impPrefix = firstAttributeOf(stmt.declaredSubstatements(), PrefixStatement.class);
stmt.addToNs(ImpPrefixToModuleIdentifier.class, impPrefix, importedModuleIdentifier);
- final URI modNs = firstAttributeOf(importedModule.declaredSubstatements(), NamespaceStatement.class);
+ final URI modNs = firstAttributeOf(importedModule.declaredSubstatements(),
+ NamespaceStatement.class);
stmt.addToNs(URIStringToImpPrefix.class, modNs.toString(), impPrefix);
}
}
}
});
-
}
- private static Entry<ModuleIdentifier, StmtContext<?, ModuleStatement, EffectiveStatement<String, ModuleStatement>>> findRecentModule(
- final ModuleIdentifier impIdentifier,
- final Map<ModuleIdentifier, StmtContext<?, ModuleStatement, EffectiveStatement<String, ModuleStatement>>> allModules) {
+ private static Entry<ModuleIdentifier, StmtContext<?, ModuleStatement,
+ EffectiveStatement<String, ModuleStatement>>> findRecentModule(final ModuleIdentifier impIdentifier,
+ final Map<ModuleIdentifier, StmtContext<?, ModuleStatement,
+ EffectiveStatement<String, ModuleStatement>>> allModules) {
ModuleIdentifier recentModuleIdentifier = impIdentifier;
- Entry<ModuleIdentifier, StmtContext<?, ModuleStatement, EffectiveStatement<String, ModuleStatement>>> recentModuleEntry = null;
+ Entry<ModuleIdentifier, StmtContext<?, ModuleStatement, EffectiveStatement<String, ModuleStatement>>>
+ recentModuleEntry = null;
- for (final Entry<ModuleIdentifier, StmtContext<?, ModuleStatement, EffectiveStatement<String, ModuleStatement>>> moduleEntry : allModules
- .entrySet()) {
+ for (final Entry<ModuleIdentifier, StmtContext<?, ModuleStatement,
+ EffectiveStatement<String, ModuleStatement>>> moduleEntry : allModules.entrySet()) {
final ModuleIdentifier id = moduleEntry.getKey();
if (id.getName().equals(impIdentifier.getName())
return recentModuleEntry;
}
- private static ModuleIdentifier getImportedModuleIdentifier(final StmtContext<String, ImportStatement, ?> stmt) {
+ private static ModuleIdentifier getImportedModuleIdentifier(
+ final StmtContext<String, ImportStatement, ?> stmt) {
Date revision = firstAttributeOf(stmt.declaredSubstatements(), RevisionDateStatement.class);
if (revision == null) {
revision = SimpleDateFormatUtil.DEFAULT_DATE_IMP;
importAction.apply(new InferenceAction() {
@Override
public void apply(final InferenceContext ctx) {
- final Entry<SemVer, StmtContext<?, ?, ?>> importedModuleEntry= findRecentCompatibleModuleEntry(
+ final Entry<SemVer, StmtContext<?, ?, ?>> importedModuleEntry = findRecentCompatibleModuleEntry(
impIdentifier.getName(), stmt);
-
- StmtContext<?, ?, ?> importedModule = null;
- ModuleIdentifier importedModuleIdentifier = null;
- ModuleIdentifier semVerModuleIdentifier = null;
- if (importedModuleEntry != null) {
- importedModule = importedModuleEntry.getValue();
- importedModuleIdentifier = importedModule.getFromNamespace(ModuleCtxToModuleIdentifier.class, importedModule);
- semVerModuleIdentifier = createSemVerModuleIdentifier(importedModuleIdentifier, importedModuleEntry.getKey());
- } else {
+ if (importedModuleEntry == null) {
throw new InferenceException(stmt.getStatementSourceReference(),
- "Unable to find module compatible with requested import [%s(%s)].", impIdentifier
- .getName(), getRequestedImportVersion(stmt));
+ "Unable to find module compatible with requested import [%s(%s)].",
+ impIdentifier.getName(), getRequestedImportVersion(stmt));
}
- linkageTarget.resolve(ctx).addToNs(ImportedModuleContext.class, importedModuleIdentifier, importedModule);
+ final StmtContext<?, ?, ?> importedModule = importedModuleEntry.getValue();
+ final ModuleIdentifier importedModuleIdentifier = importedModule.getFromNamespace(
+ ModuleCtxToModuleIdentifier.class, importedModule);
+ final ModuleIdentifier semVerModuleIdentifier = createSemVerModuleIdentifier(
+ importedModuleIdentifier, importedModuleEntry.getKey());
+
+ linkageTarget.resolve(ctx).addToNs(ImportedModuleContext.class, importedModuleIdentifier,
+ importedModule);
final String impPrefix = firstAttributeOf(stmt.declaredSubstatements(), PrefixStatement.class);
stmt.addToNs(ImpPrefixToModuleIdentifier.class, impPrefix, importedModuleIdentifier);
stmt.addToNs(ImpPrefixToSemVerModuleIdentifier.class, impPrefix, semVerModuleIdentifier);
- final URI modNs = firstAttributeOf(importedModule.declaredSubstatements(), NamespaceStatement.class);
+ final URI modNs = firstAttributeOf(importedModule.declaredSubstatements(),
+ NamespaceStatement.class);
stmt.addToNs(URIStringToImpPrefix.class, modNs.toString(), impPrefix);
}
public void prerequisiteFailed(final Collection<? extends Prerequisite<?>> failed) {
if (failed.contains(imported)) {
throw new InferenceException(stmt.getStatementSourceReference(),
- "Unable to find module compatible with requested import [%s(%s)].", impIdentifier
- .getName(), getRequestedImportVersion(stmt));
+ "Unable to find module compatible with requested import [%s(%s)].",
+ impIdentifier.getName(), getRequestedImportVersion(stmt));
}
}
});
return null;
}
- private static ModuleIdentifier getImportedModuleIdentifier(final StmtContext<String, ImportStatement, ?> impStmt) {
+ private static ModuleIdentifier getImportedModuleIdentifier(
+ final StmtContext<String, ImportStatement, ?> impStmt) {
return ModuleIdentifierImpl.create(impStmt.getStatementArgument(), Optional.empty(),
Optional.of(SimpleDateFormatUtil.DEFAULT_DATE_IMP));
}
import org.opendaylight.yangtools.yang.parser.spi.meta.ModelActionBuilder.InferenceContext;
import org.opendaylight.yangtools.yang.parser.spi.meta.ModelActionBuilder.Prerequisite;
import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
-import org.opendaylight.yangtools.yang.parser.spi.meta.SubstatementValidator;
import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext.Mutable;
+import org.opendaylight.yangtools.yang.parser.spi.meta.SubstatementValidator;
import org.opendaylight.yangtools.yang.parser.spi.source.IncludedModuleContext;
import org.opendaylight.yangtools.yang.parser.spi.source.IncludedSubmoduleNameToIdentifier;
import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.IncludeEffectiveStatementImpl;
@Override
public void onPreLinkageDeclared(
- final StmtContext.Mutable<String, IncludeStatement, EffectiveStatement<String, IncludeStatement>> stmt) {
+ final Mutable<String, IncludeStatement, EffectiveStatement<String, IncludeStatement>> stmt) {
stmt.addRequiredModule(getIncludeSubmoduleIdentifier(stmt));
}
});
}
- private static ModuleIdentifier getIncludeSubmoduleIdentifier(final StmtContext<String, IncludeStatement, ?> stmt) {
-
+ private static ModuleIdentifier getIncludeSubmoduleIdentifier(
+ final StmtContext<String, IncludeStatement, ?> stmt) {
final String subModuleName = stmt.getStatementArgument();
Date revisionDate = firstAttributeOf(stmt.declaredSubstatements(), RevisionDateStatement.class);
}
@Override
- public void onStatementAdded(final Mutable<QName, InputStatement, EffectiveStatement<QName, InputStatement>> stmt) {
+ public void onStatementAdded(final Mutable<QName, InputStatement,
+ EffectiveStatement<QName, InputStatement>> stmt) {
stmt.getParentContext().addToNs(ChildSchemaNodes.class, stmt.getStatementArgument(), stmt);
}
import org.opendaylight.yangtools.yang.parser.spi.meta.SubstatementValidator;
import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.type.InstanceIdentifierSpecificationEffectiveStatementImpl;
-public class InstanceIdentifierSpecificationImpl extends
- AbstractDeclaredStatement<String> implements InstanceIdentifierSpecification {
+public class InstanceIdentifierSpecificationImpl extends AbstractDeclaredStatement<String>
+ implements InstanceIdentifierSpecification {
private static final SubstatementValidator SUBSTATEMENT_VALIDATOR = SubstatementValidator.builder(YangStmtMapping
.TYPE)
.addOptional(YangStmtMapping.REQUIRE_INSTANCE)
.build();
- protected InstanceIdentifierSpecificationImpl(
- final StmtContext<String, InstanceIdentifierSpecification, ?> ctx) {
+ protected InstanceIdentifierSpecificationImpl(final StmtContext<String, InstanceIdentifierSpecification, ?> ctx) {
super(ctx);
}
- public static class Definition
- extends
- AbstractStatementSupport<String, InstanceIdentifierSpecification, EffectiveStatement<String, InstanceIdentifierSpecification>> {
+ public static class Definition extends AbstractStatementSupport<String, InstanceIdentifierSpecification,
+ EffectiveStatement<String, InstanceIdentifierSpecification>> {
public Definition() {
super(YangStmtMapping.TYPE);
@Override
public EffectiveStatement<String, InstanceIdentifierSpecification> createEffective(
- final StmtContext<String, InstanceIdentifierSpecification, EffectiveStatement<String, InstanceIdentifierSpecification>> ctx) {
+ final StmtContext<String, InstanceIdentifierSpecification,
+ EffectiveStatement<String, InstanceIdentifierSpecification>> ctx) {
return new InstanceIdentifierSpecificationEffectiveStatementImpl(ctx);
}
public RequireInstanceStatement getRequireInstance() {
return firstDeclared(RequireInstanceStatement.class);
}
-
}
import org.opendaylight.yangtools.yang.parser.spi.meta.SubstatementValidator;
import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.LeafListEffectiveStatementImpl;
-public class LeafListStatementImpl extends AbstractDeclaredStatement<QName>
- implements LeafListStatement {
+public class LeafListStatementImpl extends AbstractDeclaredStatement<QName> implements LeafListStatement {
private static final SubstatementValidator SUBSTATEMENT_VALIDATOR = SubstatementValidator.builder(YangStmtMapping
.LEAF_LIST)
.addOptional(YangStmtMapping.CONFIG)
.addOptional(YangStmtMapping.WHEN)
.build();
- protected LeafListStatementImpl(
- final StmtContext<QName, LeafListStatement, ?> context) {
+ protected LeafListStatementImpl(final StmtContext<QName, LeafListStatement, ?> context) {
super(context);
}
}
@Override
- public QName parseArgumentValue(final StmtContext<?, ?, ?> ctx, final String value)
- {
+ public QName parseArgumentValue(final StmtContext<?, ?, ?> ctx, final String value) {
return StmtContextUtils.qnameFromArgument(ctx, value);
}
@Override
- public LeafListStatement createDeclared(
- final StmtContext<QName, LeafListStatement, ?> ctx) {
+ public LeafListStatement createDeclared(final StmtContext<QName, LeafListStatement, ?> ctx) {
return new LeafListStatementImpl(ctx);
}
}
@Override
- public void onStatementAdded(final Mutable<QName, LeafStatement, EffectiveStatement<QName, LeafStatement>> stmt) {
+ public void onStatementAdded(final Mutable<QName, LeafStatement,
+ EffectiveStatement<QName, LeafStatement>> stmt) {
stmt.getParentContext().addToNs(ChildSchemaNodes.class, stmt.getStatementArgument(), stmt);
}
@Override
public void onFullDefinitionDeclared(
- final StmtContext.Mutable<QName, LeafStatement, EffectiveStatement<QName, LeafStatement>> ctx) {
+ final Mutable<QName, LeafStatement, EffectiveStatement<QName, LeafStatement>> ctx) {
super.onFullDefinitionDeclared(ctx);
StmtContextUtils.validateIfFeatureAndWhenOnListKeys(ctx);
}
}
- @Nullable @Override
+ @Nullable
+ @Override
public Collection<? extends MustStatement> getMusts() {
return allDeclared(MustStatement.class);
}
- @Nullable @Override
+ @Nullable
+ @Override
public DefaultStatement getDefault() {
return firstDeclared(DefaultStatement.class);
}
- @Nullable @Override
+ @Nullable
+ @Override
public ConfigStatement getConfig() {
return firstDeclared(ConfigStatement.class);
}
- @Nullable @Override
+ @Nullable
+ @Override
public MandatoryStatement getMandatory() {
return firstDeclared(MandatoryStatement.class);
}
- @Nonnull @Override
+ @Nonnull
+ @Override
public QName getName() {
return argument();
}
return firstDeclared(WhenStatement.class);
}
- @Nonnull @Override
+ @Nonnull
+ @Override
public Collection<? extends IfFeatureStatement> getIfFeatures() {
return allDeclared(IfFeatureStatement.class);
}
- @Nullable @Override
+ @Nullable
+ @Override
public DescriptionStatement getDescription() {
return firstDeclared(DescriptionStatement.class);
}
- @Nullable @Override
+ @Nullable
+ @Override
public ReferenceStatement getReference() {
return firstDeclared(ReferenceStatement.class);
}
- @Nonnull @Override
+ @Nonnull
+ @Override
public TypeStatement getType() {
return firstDeclared(TypeStatement.class);
}
- @Nullable @Override
+ @Nullable
+ @Override
public UnitsStatement getUnits() {
return firstDeclared(UnitsStatement.class);
}
- @Nullable @Override
+ @Nullable
+ @Override
public StatusStatement getStatus() {
return firstDeclared(StatusStatement.class);
}
import org.opendaylight.yangtools.yang.parser.spi.meta.SubstatementValidator;
import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.ListEffectiveStatementImpl;
-public class ListStatementImpl extends AbstractDeclaredStatement<QName>
- implements ListStatement {
+public class ListStatementImpl extends AbstractDeclaredStatement<QName> implements ListStatement {
private static final SubstatementValidator SUBSTATEMENT_VALIDATOR = SubstatementValidator.builder(YangStmtMapping
.LIST)
.addAny(YangStmtMapping.ANYXML)
}
public static class Definition
- extends
- AbstractQNameStatementSupport<ListStatement, EffectiveStatement<QName, ListStatement>> {
+ extends AbstractQNameStatementSupport<ListStatement, EffectiveStatement<QName, ListStatement>> {
public Definition() {
super(YangStmtMapping.LIST);
}
@Override
- public void onStatementAdded(final Mutable<QName, ListStatement, EffectiveStatement<QName, ListStatement>> stmt) {
+ public void onStatementAdded(
+ final Mutable<QName, ListStatement, EffectiveStatement<QName, ListStatement>> stmt) {
stmt.getParentContext().addToNs(ChildSchemaNodes.class, stmt.getStatementArgument(), stmt);
}
@Override
public EffectiveStatement<Integer, MinElementsStatement> createEffective(
- final StmtContext<Integer, MinElementsStatement, EffectiveStatement<Integer, MinElementsStatement>> ctx) {
+ final StmtContext<Integer, MinElementsStatement,
+ EffectiveStatement<Integer, MinElementsStatement>> ctx) {
return new MinElementsEffectiveStatementImpl(ctx);
}
public Integer getValue() {
return argument();
}
-
}
}
@Override
- public void onPreLinkageDeclared(final Mutable<String, ModuleStatement, EffectiveStatement<String, ModuleStatement>> stmt) {
+ public void onPreLinkageDeclared(final Mutable<String, ModuleStatement,
+ EffectiveStatement<String, ModuleStatement>> stmt) {
final String moduleName = stmt.getStatementArgument();
final URI moduleNs = firstAttributeOf(stmt.declaredSubstatements(), NamespaceStatement.class);
}
@Override
- public void onLinkageDeclared(final Mutable<String, ModuleStatement, EffectiveStatement<String, ModuleStatement>> stmt) {
+ public void onLinkageDeclared(final Mutable<String, ModuleStatement,
+ EffectiveStatement<String, ModuleStatement>> stmt) {
final Optional<URI> moduleNs = Optional.ofNullable(firstAttributeOf(stmt.declaredSubstatements(),
NamespaceStatement.class));
}
final QNameModule qNameModule = QNameModule.create(moduleNs.get(), revisionDate.orElse(null)).intern();
-
final StmtContext<?, ModuleStatement, EffectiveStatement<String, ModuleStatement>> possibleDuplicateModule =
stmt.getFromNamespace(NamespaceToModule.class, qNameModule);
if (possibleDuplicateModule != null && possibleDuplicateModule != stmt) {
modulesMap = new TreeMap<>();
}
SemVer moduleSemVer = stmt.getFromNamespace(SemanticVersionNamespace.class, stmt);
- if(moduleSemVer == null) {
+ if (moduleSemVer == null) {
moduleSemVer = Module.DEFAULT_SEMANTIC_VERSION;
}
modulesMap.put(moduleSemVer, stmt);
super(context);
}
- public static class Definition extends
- AbstractStatementSupport<RevisionAwareXPath, MustStatement, EffectiveStatement<RevisionAwareXPath, MustStatement>> {
+ public static class Definition extends AbstractStatementSupport<RevisionAwareXPath, MustStatement,
+ EffectiveStatement<RevisionAwareXPath, MustStatement>> {
public Definition() {
super(YangStmtMapping.MUST);
@Override
public EffectiveStatement<RevisionAwareXPath, MustStatement> createEffective(
- final StmtContext<RevisionAwareXPath, MustStatement, EffectiveStatement<RevisionAwareXPath, MustStatement>> ctx) {
+ final StmtContext<RevisionAwareXPath, MustStatement,
+ EffectiveStatement<RevisionAwareXPath, MustStatement>> ctx) {
return new MustEffectiveStatementImpl(ctx);
}
.NAMESPACE)
.build();
- public static class Definition extends AbstractStatementSupport<URI,NamespaceStatement,EffectiveStatement<URI,NamespaceStatement>> {
+ public static class Definition extends AbstractStatementSupport<URI, NamespaceStatement,
+ EffectiveStatement<URI, NamespaceStatement>> {
public Definition() {
super(org.opendaylight.yangtools.yang.model.api.YangStmtMapping.NAMESPACE);
}
@Override
- public EffectiveStatement<URI,NamespaceStatement> createEffective(final StmtContext<URI, NamespaceStatement,EffectiveStatement<URI,NamespaceStatement>> ctx) {
+ public EffectiveStatement<URI,NamespaceStatement> createEffective(
+ final StmtContext<URI, NamespaceStatement, EffectiveStatement<URI, NamespaceStatement>> ctx) {
return new NamespaceEffectiveStatementImpl(ctx);
}
@Override
public EffectiveStatement<String, NumericalRestrictions> createEffective(
- final StmtContext<String, NumericalRestrictions, EffectiveStatement<String, NumericalRestrictions>> ctx) {
+ final StmtContext<String, NumericalRestrictions,
+ EffectiveStatement<String, NumericalRestrictions>> ctx) {
return new NumericalRestrictionsEffectiveStatementImpl(ctx);
}
public RangeStatement getRange() {
return firstDeclared(RangeStatement.class);
}
-
}
import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractStatementSupport;
import org.opendaylight.yangtools.yang.parser.spi.meta.SemanticVersionNamespace;
import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
+import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext.Mutable;
import org.opendaylight.yangtools.yang.parser.spi.meta.SubstatementValidator;
import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.OpenconfigVersionEffectiveStatementImpl;
@Beta
-public final class OpenconfigVersionStatementImpl extends AbstractDeclaredStatement<SemVer> implements
- UnknownStatement<SemVer> {
+public final class OpenconfigVersionStatementImpl extends AbstractDeclaredStatement<SemVer>
+ implements UnknownStatement<SemVer> {
private static final SubstatementValidator SUBSTATEMENT_VALIDATOR = SubstatementValidator.builder(
SupportedExtensionsMapping.OPENCONFIG_VERSION).build();
super(context);
}
- public static class OpenconfigVersionSupport
- extends
- AbstractStatementSupport<SemVer, UnknownStatement<SemVer>, EffectiveStatement<SemVer, UnknownStatement<SemVer>>> {
+ public static class OpenconfigVersionSupport extends AbstractStatementSupport<SemVer, UnknownStatement<SemVer>,
+ EffectiveStatement<SemVer, UnknownStatement<SemVer>>> {
public OpenconfigVersionSupport() {
super(SupportedExtensionsMapping.OPENCONFIG_VERSION);
}
@Override
- public void onLinkageDeclared(final StmtContext.Mutable<SemVer,UnknownStatement<SemVer>,EffectiveStatement<SemVer,UnknownStatement<SemVer>>> stmt) {
+ public void onLinkageDeclared(final Mutable<SemVer, UnknownStatement<SemVer>,
+ EffectiveStatement<SemVer, UnknownStatement<SemVer>>> stmt) {
stmt.addToNs(SemanticVersionNamespace.class, stmt.getParentContext(), stmt.getStatementArgument());
}
@Override
- public UnknownStatement<SemVer> createDeclared(
- final StmtContext<SemVer, UnknownStatement<SemVer>, ?> ctx) {
+ public UnknownStatement<SemVer> createDeclared(final StmtContext<SemVer, UnknownStatement<SemVer>, ?> ctx) {
return new OpenconfigVersionStatementImpl(ctx);
}
@Override
public EffectiveStatement<SemVer, UnknownStatement<SemVer>> createEffective(
- final StmtContext<SemVer, UnknownStatement<SemVer>, EffectiveStatement<SemVer, UnknownStatement<SemVer>>> ctx) {
+ final StmtContext<SemVer, UnknownStatement<SemVer>,
+ EffectiveStatement<SemVer, UnknownStatement<SemVer>>> ctx) {
return new OpenconfigVersionEffectiveStatementImpl(ctx);
}
@Override
public EffectiveStatement<String, OrganizationStatement> createEffective(
- final StmtContext<String, OrganizationStatement, EffectiveStatement<String, OrganizationStatement>> ctx) {
+ final StmtContext<String, OrganizationStatement,
+ EffectiveStatement<String, OrganizationStatement>> ctx) {
return new OrganizationEffectiveStatementImpl(ctx);
}
public String getText() {
return argument();
}
-
}
}
@Override
- public void onStatementAdded(final Mutable<QName, OutputStatement, EffectiveStatement<QName, OutputStatement>> stmt) {
+ public void onStatementAdded(final Mutable<QName, OutputStatement,
+ EffectiveStatement<QName, OutputStatement>> stmt) {
stmt.getParentContext().addToNs(ChildSchemaNodes.class, stmt.getStatementArgument(), stmt);
}
return allDeclared(MustStatement.class);
}
}
-
super(context);
}
- public static class Definition extends
- AbstractStatementSupport<RevisionAwareXPath, PathStatement, EffectiveStatement<RevisionAwareXPath, PathStatement>> {
+ public static class Definition extends AbstractStatementSupport<RevisionAwareXPath, PathStatement,
+ EffectiveStatement<RevisionAwareXPath, PathStatement>> {
public Definition() {
super(YangStmtMapping.PATH);
@Override
public EffectiveStatement<RevisionAwareXPath, PathStatement> createEffective(
- final StmtContext<RevisionAwareXPath, PathStatement, EffectiveStatement<RevisionAwareXPath, PathStatement>> ctx) {
+ final StmtContext<RevisionAwareXPath, PathStatement,
+ EffectiveStatement<RevisionAwareXPath, PathStatement>> ctx) {
return new PathEffectiveStatementImpl(ctx);
}
super(context);
}
- public static class Definition
- extends
- AbstractStatementSupport<PatternConstraint, PatternStatement, EffectiveStatement<PatternConstraint, PatternStatement>> {
+ public static class Definition extends AbstractStatementSupport<PatternConstraint, PatternStatement,
+ EffectiveStatement<PatternConstraint, PatternStatement>> {
public Definition() {
super(YangStmtMapping.PATTERN);
@Override
public EffectiveStatement<PatternConstraint, PatternStatement> createEffective(
- final StmtContext<PatternConstraint, PatternStatement, EffectiveStatement<PatternConstraint, PatternStatement>> ctx) {
+ final StmtContext<PatternConstraint, PatternStatement,
+ EffectiveStatement<PatternConstraint, PatternStatement>> ctx) {
return new PatternEffectiveStatementImpl(ctx);
}
super(context);
}
- public static class Definition extends AbstractStatementSupport<String,ReferenceStatement,EffectiveStatement<String,ReferenceStatement>> {
+ public static class Definition extends AbstractStatementSupport<String, ReferenceStatement,
+ EffectiveStatement<String, ReferenceStatement>> {
public Definition() {
super(YangStmtMapping.REFERENCE);
}
}
- @Nonnull @Override
+ @Nonnull
+ @Override
public String getText() {
return rawArgument();
}
super(context);
}
- public static class Definition extends
- AbstractStatementSupport<SchemaNodeIdentifier, RefineStatement, EffectiveStatement<SchemaNodeIdentifier, RefineStatement>> {
+ public static class Definition extends AbstractStatementSupport<SchemaNodeIdentifier, RefineStatement,
+ EffectiveStatement<SchemaNodeIdentifier, RefineStatement>> {
public Definition() {
super(YangStmtMapping.REFINE);
@Override
public EffectiveStatement<SchemaNodeIdentifier, RefineStatement> createEffective(
- final StmtContext<SchemaNodeIdentifier, RefineStatement, EffectiveStatement<SchemaNodeIdentifier, RefineStatement>> ctx) {
+ final StmtContext<SchemaNodeIdentifier, RefineStatement,
+ EffectiveStatement<SchemaNodeIdentifier, RefineStatement>> ctx) {
return new RefineEffectiveStatementImpl(ctx);
}
import org.opendaylight.yangtools.yang.parser.spi.meta.SubstatementValidator;
import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.RequireInstanceEffectiveStatementImpl;
-public class RequireInstanceStatementImpl extends
- AbstractDeclaredStatement<Boolean> implements RequireInstanceStatement {
+public class RequireInstanceStatementImpl extends AbstractDeclaredStatement<Boolean>
+ implements RequireInstanceStatement {
private static final SubstatementValidator SUBSTATEMENT_VALIDATOR = SubstatementValidator.builder(
YangStmtMapping.REQUIRE_INSTANCE).build();
super(context);
}
- public static class Definition extends
- AbstractStatementSupport<Boolean, RequireInstanceStatement, EffectiveStatement<Boolean, RequireInstanceStatement>> {
+ public static class Definition extends AbstractStatementSupport<Boolean, RequireInstanceStatement,
+ EffectiveStatement<Boolean, RequireInstanceStatement>> {
public Definition() {
super(YangStmtMapping.REQUIRE_INSTANCE);
@Override
public EffectiveStatement<Boolean, RequireInstanceStatement> createEffective(
- final StmtContext<Boolean, RequireInstanceStatement, EffectiveStatement<Boolean, RequireInstanceStatement>> ctx) {
+ final StmtContext<Boolean, RequireInstanceStatement,
+ EffectiveStatement<Boolean, RequireInstanceStatement>> ctx) {
return new RequireInstanceEffectiveStatementImpl(ctx);
}
import org.opendaylight.yangtools.yang.parser.stmt.reactor.StatementDefinitionContext;
import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.RpcEffectiveStatementImpl;
-public class RpcStatementImpl extends AbstractDeclaredStatement<QName>
- implements RpcStatement {
+public class RpcStatementImpl extends AbstractDeclaredStatement<QName> implements RpcStatement {
private static final SubstatementValidator SUBSTATEMENT_VALIDATOR = SubstatementValidator.builder(YangStmtMapping
.RPC)
.addOptional(YangStmtMapping.DESCRIPTION)
}
@Override
- public void onFullDefinitionDeclared(final Mutable<QName, RpcStatement, EffectiveStatement<QName, RpcStatement>> stmt) {
+ public void onFullDefinitionDeclared(
+ final Mutable<QName, RpcStatement, EffectiveStatement<QName, RpcStatement>> stmt) {
super.onFullDefinitionDeclared(stmt);
if (StmtContextUtils.findFirstDeclaredSubstatement(stmt, InputStatement.class) == null) {
import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext.Mutable;
import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContextUtils;
-public class SchemaNodeIdentifierBuildNamespace extends
- DerivedNamespaceBehaviour<SchemaNodeIdentifier, StmtContext.Mutable<?, ?,
- EffectiveStatement<?, ?>>, QName, SchemaNodeIdentifierBuildNamespace, ChildSchemaNodes<?, ?>>
+public class SchemaNodeIdentifierBuildNamespace extends DerivedNamespaceBehaviour<SchemaNodeIdentifier, Mutable<?, ?,
+ EffectiveStatement<?, ?>>, QName, SchemaNodeIdentifierBuildNamespace, ChildSchemaNodes<?, ?>>
implements IdentifierNamespace<SchemaNodeIdentifier, StmtContext.Mutable<?, ?, EffectiveStatement<?, ?>>> {
@SuppressWarnings({"unchecked", "rawtypes"})
@SuppressWarnings("unchecked")
@Override
- public StmtContext.Mutable<?, ?, EffectiveStatement<?, ?>> getFrom(final NamespaceStorageNode storage,
+ public Mutable<?, ?, EffectiveStatement<?, ?>> getFrom(final NamespaceStorageNode storage,
final SchemaNodeIdentifier key) {
final NamespaceStorageNode lookupStartStorage;
if (key.isAbsolute() || storage.getStorageNodeType() == StorageNodeType.ROOT_STATEMENT_LOCAL) {
final Iterator<QName> iterator = key.getPathFromRoot().iterator();
if (!iterator.hasNext()) {
if (lookupStartStorage instanceof StmtContext<?, ?, ?>) {
- return (StmtContext.Mutable<?, ?, EffectiveStatement<?, ?>>) lookupStartStorage;
+ return (Mutable<?, ?, EffectiveStatement<?, ?>>) lookupStartStorage;
}
return null;
}
QName nextPath = iterator.next();
- StmtContext.Mutable<?, ?, EffectiveStatement<?, ?>> current = lookupStartStorage
- .getFromLocalStorage(ChildSchemaNodes.class, nextPath);
+ Mutable<?, ?, EffectiveStatement<?, ?>> current = lookupStartStorage.getFromLocalStorage(ChildSchemaNodes.class,
+ nextPath);
if (current == null && lookupStartStorage instanceof StmtContext<?, ?, ?>) {
- return tryToFindUnknownStatement(nextPath.getLocalName(), (Mutable<?, ?, EffectiveStatement<?, ?>>) lookupStartStorage);
+ return tryToFindUnknownStatement(nextPath.getLocalName(),
+ (Mutable<?, ?, EffectiveStatement<?, ?>>) lookupStartStorage);
}
while (current != null && iterator.hasNext()) {
nextPath = iterator.next();
final Mutable<String, SubmoduleStatement, EffectiveStatement<String, SubmoduleStatement>> stmt) {
final ModuleIdentifier submoduleIdentifier = getSubmoduleIdentifier(stmt);
- final StmtContext<?, SubmoduleStatement, EffectiveStatement<String, SubmoduleStatement>> possibleDuplicateSubmodule =
- stmt.getFromNamespace(SubmoduleNamespace.class, submoduleIdentifier);
+ final StmtContext<?, SubmoduleStatement, EffectiveStatement<String, SubmoduleStatement>>
+ possibleDuplicateSubmodule = stmt.getFromNamespace(SubmoduleNamespace.class, submoduleIdentifier);
if (possibleDuplicateSubmodule != null && possibleDuplicateSubmodule != stmt) {
throw new SourceException(stmt.getStatementSourceReference(), "Submodule name collision: %s. At %s",
stmt.getStatementArgument(), possibleDuplicateSubmodule.getStatementSourceReference());
public BelongsToStatement getBelongsTo() {
return firstDeclared(BelongsToStatement.class);
}
-
}
this.yinElement = yinElement;
}
- private SupportedExtensionsMapping(final String namespace, final Class<? extends DeclaredStatement<?>> declared,
+ SupportedExtensionsMapping(final String namespace, final Class<? extends DeclaredStatement<?>> declared,
final Class<? extends EffectiveStatement<?, ?>> effective, final String nameStr, final String argumentStr,
final boolean yinElement) {
type = Preconditions.checkNotNull(declared);
super(context);
}
- public static class Definition extends
- AbstractStatementSupport<String, UnknownStatement<String>, EffectiveStatement<String, UnknownStatement<String>>> {
+ public static class Definition extends AbstractStatementSupport<String, UnknownStatement<String>,
+ EffectiveStatement<String, UnknownStatement<String>>> {
public Definition(final StatementDefinition publicDefinition) {
super(publicDefinition);
@Override
public EffectiveStatement<String, UnknownStatement<String>> createEffective(
- final StmtContext<String, UnknownStatement<String>, EffectiveStatement<String, UnknownStatement<String>>> ctx) {
+ final StmtContext<String, UnknownStatement<String>,
+ EffectiveStatement<String, UnknownStatement<String>>> ctx) {
return new UnknownEffectiveStatementImpl(ctx);
}
@Override
public void apply(final InferenceContext ctx) {
- final StatementContextBase<?, ?, ?> targetNodeStmtCtx = (StatementContextBase<?, ?, ?>) targetNodePre.resolve(ctx);
- final StatementContextBase<?, ?, ?> sourceGrpStmtCtx = (StatementContextBase<?, ?, ?>) sourceGroupingPre.resolve(ctx);
+ final StatementContextBase<?, ?, ?> targetNodeStmtCtx =
+ (StatementContextBase<?, ?, ?>) targetNodePre.resolve(ctx);
+ final StatementContextBase<?, ?, ?> sourceGrpStmtCtx =
+ (StatementContextBase<?, ?, ?>) sourceGroupingPre.resolve(ctx);
try {
copyFromSourceToTarget(sourceGrpStmtCtx, targetNodeStmtCtx, usesNode);
}
/**
+ * Copy statements from a grouping to a target node.
+ *
* @param sourceGrpStmtCtx
* source grouping statement context
* @param targetCtx
*/
static void copyFromSourceToTarget(final Mutable<?, ?, ?> sourceGrpStmtCtx,
final StatementContextBase<?, ?, ?> targetCtx,
- final StmtContext.Mutable<QName, UsesStatement, EffectiveStatement<QName, UsesStatement>> usesNode) {
+ final Mutable<QName, UsesStatement, EffectiveStatement<QName, UsesStatement>> usesNode) {
final Collection<? extends Mutable<?, ?, ?>> declared = sourceGrpStmtCtx.mutableDeclaredSubstatements();
final Collection<? extends Mutable<?, ?, ?>> effective = sourceGrpStmtCtx.mutableEffectiveSubstatements();
final Collection<Mutable<?, ?, ?>> buffer = new ArrayList<>(declared.size() + effective.size());
return null;
}
-
}
.addSupport(global(StmtOrderingNamespace.class))
.build();
- public static final Map<ModelProcessingPhase, StatementSupportBundle> RFC6020_BUNDLES = ImmutableMap
- .<ModelProcessingPhase, StatementSupportBundle> builder()
+ public static final Map<ModelProcessingPhase, StatementSupportBundle> RFC6020_BUNDLES =
+ ImmutableMap.<ModelProcessingPhase, StatementSupportBundle>builder()
.put(ModelProcessingPhase.INIT, INIT_BUNDLE)
.put(ModelProcessingPhase.SOURCE_PRE_LINKAGE, PRE_LINKAGE_BUNDLE)
.put(ModelProcessingPhase.SOURCE_LINKAGE, LINKAGE_BUNDLE)
.put(ModelProcessingPhase.EFFECTIVE_MODEL, FULL_DECL_BUNDLE)
.build();
- public static final Map<ValidationBundleType, Collection<StatementDefinition>> RFC6020_VALIDATION_BUNDLE = ImmutableMap
- .<ValidationBundleType, Collection<StatementDefinition>> builder()
- .put(ValidationBundleType.SUPPORTED_REFINE_SUBSTATEMENTS, YangValidationBundles.SUPPORTED_REFINE_SUBSTATEMENTS)
+ public static final Map<ValidationBundleType, Collection<StatementDefinition>> RFC6020_VALIDATION_BUNDLE =
+ ImmutableMap.<ValidationBundleType, Collection<StatementDefinition>>builder()
+ .put(ValidationBundleType.SUPPORTED_REFINE_SUBSTATEMENTS,
+ YangValidationBundles.SUPPORTED_REFINE_SUBSTATEMENTS)
.put(ValidationBundleType.SUPPORTED_AUGMENT_TARGETS, YangValidationBundles.SUPPORTED_AUGMENT_TARGETS)
.put(ValidationBundleType.SUPPORTED_CASE_SHORTHANDS, YangValidationBundles.SUPPORTED_CASE_SHORTHANDS)
.put(ValidationBundleType.SUPPORTED_DATA_NODES, YangValidationBundles.SUPPORTED_DATA_NODES)
.build();
- public static final CrossSourceStatementReactor RFC6020_REACTOR = CrossSourceStatementReactor
- .builder()
+ public static final CrossSourceStatementReactor RFC6020_REACTOR = CrossSourceStatementReactor.builder()
.setBundle(ModelProcessingPhase.INIT, INIT_BUNDLE)
.setBundle(ModelProcessingPhase.SOURCE_PRE_LINKAGE, PRE_LINKAGE_BUNDLE)
.setBundle(ModelProcessingPhase.SOURCE_LINKAGE, LINKAGE_BUNDLE)
- .setBundle(ModelProcessingPhase.STATEMENT_DEFINITION,
- STMT_DEF_BUNDLE)
+ .setBundle(ModelProcessingPhase.STATEMENT_DEFINITION, STMT_DEF_BUNDLE)
.setBundle(ModelProcessingPhase.FULL_DECLARATION, FULL_DECL_BUNDLE)
.setBundle(ModelProcessingPhase.EFFECTIVE_MODEL, FULL_DECL_BUNDLE)
- .setValidationBundle(
- ValidationBundleType.SUPPORTED_REFINE_SUBSTATEMENTS,
+ .setValidationBundle(ValidationBundleType.SUPPORTED_REFINE_SUBSTATEMENTS,
YangValidationBundles.SUPPORTED_REFINE_SUBSTATEMENTS)
.setValidationBundle(ValidationBundleType.SUPPORTED_AUGMENT_TARGETS,
YangValidationBundles.SUPPORTED_AUGMENT_TARGETS)
}
}
- @Nonnull @Override
+ @Nonnull
+ @Override
public YangVersion getValue() {
return argument();
}