Fix license header violations in yang-parser-impl
[yangtools.git] / yang / yang-parser-impl / src / main / java / org / opendaylight / yangtools / yang / parser / stmt / rfc6020 / ConfigStatementImpl.java
1 /**
2  * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
3  *
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
7  */
8
9 package org.opendaylight.yangtools.yang.parser.stmt.rfc6020;
10
11 import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.ConfigEffectiveStatementImpl;
12
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.ConfigStatement;
16 import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractDeclaredStatement;
17 import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractStatementSupport;
18 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
19 import org.opendaylight.yangtools.yang.parser.spi.source.SourceException;
20 import javax.annotation.Nonnull;
21
22 public class ConfigStatementImpl extends AbstractDeclaredStatement<Boolean> implements ConfigStatement {
23
24     protected ConfigStatementImpl(
25             StmtContext<Boolean, ConfigStatement, ?> context) {
26         super(context);
27     }
28
29     public static class Definition extends AbstractStatementSupport<Boolean,ConfigStatement,EffectiveStatement<Boolean,ConfigStatement>> {
30
31         public Definition() {
32             super(Rfc6020Mapping.CONFIG);
33         }
34
35         @Override public Boolean parseArgumentValue(StmtContext<?, ?, ?> ctx,
36                 String value) throws SourceException {
37             return Boolean.valueOf(value);
38         }
39
40         @Override public ConfigStatement createDeclared(StmtContext<Boolean, ConfigStatement, ?> ctx) {
41             return new ConfigStatementImpl(ctx);
42         }
43
44         @Override public EffectiveStatement<Boolean, ConfigStatement> createEffective(StmtContext<Boolean, ConfigStatement, EffectiveStatement<Boolean, ConfigStatement>> ctx) {
45             return new ConfigEffectiveStatementImpl(ctx);
46         }
47     }
48
49     @Nonnull @Override
50     public Boolean getValue() {
51         return argument();
52     }
53 }