2 * Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.yangtools.yang.parser.stmt.rfc6020;
10 import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.MustEffectiveStatementImpl;
12 import org.opendaylight.yangtools.yang.model.api.RevisionAwareXPath;
13 import org.opendaylight.yangtools.yang.model.api.Rfc6020Mapping;
14 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
15 import org.opendaylight.yangtools.yang.model.api.stmt.DescriptionStatement;
16 import org.opendaylight.yangtools.yang.model.api.stmt.ErrorAppTagStatement;
17 import org.opendaylight.yangtools.yang.model.api.stmt.ErrorMessageStatement;
18 import org.opendaylight.yangtools.yang.model.api.stmt.MustStatement;
19 import org.opendaylight.yangtools.yang.model.api.stmt.ReferenceStatement;
20 import org.opendaylight.yangtools.yang.model.util.RevisionAwareXPathImpl;
21 import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractDeclaredStatement;
22 import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractStatementSupport;
23 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
24 import org.opendaylight.yangtools.yang.parser.spi.source.SourceException;
25 import javax.annotation.Nonnull;
26 import javax.annotation.Nullable;
28 public class MustStatementImpl extends AbstractDeclaredStatement<RevisionAwareXPath> implements
31 protected MustStatementImpl(
32 StmtContext<RevisionAwareXPath, MustStatement, ?> context) {
36 public static class Definition extends AbstractStatementSupport<RevisionAwareXPath,MustStatement,EffectiveStatement<RevisionAwareXPath,MustStatement>> {
39 super(Rfc6020Mapping.MUST);
42 @Override public RevisionAwareXPath parseArgumentValue(
43 StmtContext<?, ?, ?> ctx, String value) throws SourceException {
44 return new RevisionAwareXPathImpl(value, Utils.isXPathAbsolute(value));
47 @Override public MustStatement createDeclared(
48 StmtContext<RevisionAwareXPath, MustStatement, ?> ctx) {
49 return new MustStatementImpl(ctx);
52 @Override public EffectiveStatement<RevisionAwareXPath, MustStatement> createEffective(
53 StmtContext<RevisionAwareXPath, MustStatement, EffectiveStatement<RevisionAwareXPath, MustStatement>> ctx) {
54 return new MustEffectiveStatementImpl(ctx);
59 public RevisionAwareXPath getCondition() {
64 public ErrorAppTagStatement getErrorAppTagStatement() {
65 return firstDeclared(ErrorAppTagStatement.class);
69 public ErrorMessageStatement getErrorMessageStatement() {
70 return firstDeclared(ErrorMessageStatement.class);
74 public DescriptionStatement getDescription() {
75 return firstDeclared(DescriptionStatement.class);
79 public ReferenceStatement getReference() {
80 return firstDeclared(ReferenceStatement.class);