*/
package org.opendaylight.yangtools.yang.parser.stmt.rfc6020;
-import static org.opendaylight.yangtools.yang.parser.spi.SubstatementValidator.MAX;
-
import java.util.Collection;
+import javax.annotation.Nonnull;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.model.api.Rfc6020Mapping;
import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
implements FeatureStatement {
private static final SubstatementValidator SUBSTATEMENT_VALIDATOR = SubstatementValidator.builder(Rfc6020Mapping
.FEATURE)
- .add(Rfc6020Mapping.DESCRIPTION, 0, 1)
- .add(Rfc6020Mapping.IF_FEATURE, 0, MAX)
- .add(Rfc6020Mapping.STATUS, 0, 1)
- .add(Rfc6020Mapping.REFERENCE, 0, 1)
+ .addOptional(Rfc6020Mapping.DESCRIPTION)
+ .addAny(Rfc6020Mapping.IF_FEATURE)
+ .addOptional(Rfc6020Mapping.STATUS)
+ .addOptional(Rfc6020Mapping.REFERENCE)
.build();
protected FeatureStatementImpl(
- StmtContext<QName, FeatureStatement, ?> context) {
+ final StmtContext<QName, FeatureStatement, ?> context) {
super(context);
}
}
@Override
- public QName parseArgumentValue(StmtContext<?, ?, ?> ctx, String value) {
+ public QName parseArgumentValue(final StmtContext<?, ?, ?> ctx, final String value) {
return Utils.qNameFromArgument(ctx, value);
}
@Override
public FeatureStatement createDeclared(
- StmtContext<QName, FeatureStatement, ?> ctx) {
+ final StmtContext<QName, FeatureStatement, ?> ctx) {
return new FeatureStatementImpl(ctx);
}
@Override
public EffectiveStatement<QName, FeatureStatement> createEffective(
- StmtContext<QName, FeatureStatement, EffectiveStatement<QName, FeatureStatement>> ctx) {
+ final StmtContext<QName, FeatureStatement, EffectiveStatement<QName, FeatureStatement>> ctx) {
return new FeatureEffectiveStatementImpl(ctx);
}
@Override
- public void onFullDefinitionDeclared(StmtContext.Mutable<QName, FeatureStatement,
+ public void onFullDefinitionDeclared(final StmtContext.Mutable<QName, FeatureStatement,
EffectiveStatement<QName, FeatureStatement>> stmt) {
super.onFullDefinitionDeclared(stmt);
SUBSTATEMENT_VALIDATOR.validate(stmt);
return firstDeclared(ReferenceStatement.class);
}
+ @Nonnull
@Override
public Collection<? extends IfFeatureStatement> getIfFeatures() {
return allDeclared(IfFeatureStatement.class);
}
+ @Nonnull
@Override
public QName getName() {
return argument();