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.model.api.RevisionAwareXPath;
11 import org.opendaylight.yangtools.yang.model.api.Rfc6020Mapping;
12 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
13 import org.opendaylight.yangtools.yang.model.api.stmt.DescriptionStatement;
14 import org.opendaylight.yangtools.yang.model.api.stmt.ReferenceStatement;
15 import org.opendaylight.yangtools.yang.model.api.stmt.WhenStatement;
16 import org.opendaylight.yangtools.yang.model.util.RevisionAwareXPathImpl;
17 import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractDeclaredStatement;
18 import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractStatementSupport;
19 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
20 import org.opendaylight.yangtools.yang.parser.spi.source.SourceException;
22 import javax.annotation.Nonnull;
23 import javax.annotation.Nullable;
25 public class WhenStatementImpl extends AbstractDeclaredStatement<RevisionAwareXPath> implements
28 protected WhenStatementImpl(
29 StmtContext<RevisionAwareXPath, WhenStatement, ?> context) {
33 public static class Definition extends AbstractStatementSupport<RevisionAwareXPath,WhenStatement,EffectiveStatement<RevisionAwareXPath,WhenStatement>> {
36 super(Rfc6020Mapping.WHEN);
39 @Override public RevisionAwareXPath parseArgumentValue(
40 StmtContext<?, ?, ?> ctx, String value) throws SourceException {
41 return new RevisionAwareXPathImpl(value, false);
44 @Override public WhenStatement createDeclared(
45 StmtContext<RevisionAwareXPath, WhenStatement, ?> ctx) {
46 return new WhenStatementImpl(ctx);
49 @Override public EffectiveStatement<RevisionAwareXPath, WhenStatement> createEffective(
50 StmtContext<RevisionAwareXPath, WhenStatement, EffectiveStatement<RevisionAwareXPath, WhenStatement>> ctx) {
51 throw new UnsupportedOperationException();
56 public RevisionAwareXPath getCondition() {
61 public DescriptionStatement getDescription() {
62 return firstDeclared(DescriptionStatement.class);
66 public ReferenceStatement getReference() {
67 return firstDeclared(ReferenceStatement.class);