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.Rfc6020Mapping;
11 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
12 import org.opendaylight.yangtools.yang.model.api.stmt.ValueStatement;
13 import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractDeclaredStatement;
14 import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractStatementSupport;
15 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
16 import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.ValueEffectiveStatementImpl;
18 public class ValueStatementImpl extends AbstractDeclaredStatement<Integer> implements ValueStatement {
20 protected ValueStatementImpl(StmtContext<Integer, ValueStatement, ?> context) {
24 public static class Definition extends
25 AbstractStatementSupport<Integer, ValueStatement, EffectiveStatement<Integer, ValueStatement>> {
28 super(Rfc6020Mapping.VALUE);
32 public Integer parseArgumentValue(StmtContext<?, ?, ?> ctx, String value) {
36 valueNum = Integer.parseInt(value);
37 } catch (NumberFormatException e) {
38 throw new IllegalArgumentException(
40 "%s is not valid value statement integer argument in a range of -2147483648..2147483647",
48 public ValueStatement createDeclared(StmtContext<Integer, ValueStatement, ?> ctx) {
49 return new ValueStatementImpl(ctx);
53 public EffectiveStatement<Integer, ValueStatement> createEffective(
54 StmtContext<Integer, ValueStatement, EffectiveStatement<Integer, ValueStatement>> ctx) {
55 return new ValueEffectiveStatementImpl(ctx);
61 public Integer getValue() {