2 * Copyright (c) 2017 Pantheon Technologies, s.r.o. 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.rfc7950.stmt.presence;
10 import com.google.common.collect.ImmutableList;
11 import org.opendaylight.yangtools.yang.model.api.YangStmtMapping;
12 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
13 import org.opendaylight.yangtools.yang.model.api.stmt.PresenceEffectiveStatement;
14 import org.opendaylight.yangtools.yang.model.api.stmt.PresenceStatement;
15 import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.BaseStringStatementSupport;
16 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
17 import org.opendaylight.yangtools.yang.parser.spi.meta.SubstatementValidator;
19 public final class PresenceStatementSupport
20 extends BaseStringStatementSupport<PresenceStatement, PresenceEffectiveStatement> {
21 private static final SubstatementValidator SUBSTATEMENT_VALIDATOR =
22 SubstatementValidator.builder(YangStmtMapping.PRESENCE).build();
23 private static final PresenceStatementSupport INSTANCE = new PresenceStatementSupport();
25 private PresenceStatementSupport() {
26 super(YangStmtMapping.PRESENCE);
29 public static PresenceStatementSupport getInstance() {
34 public String parseArgumentValue(final StmtContext<?, ?, ?> ctx, final String value) {
39 public PresenceStatement createDeclared(final StmtContext<String, PresenceStatement, ?> ctx) {
40 return new PresenceStatementImpl(ctx);
44 protected SubstatementValidator getSubstatementValidator() {
45 return SUBSTATEMENT_VALIDATOR;
49 protected PresenceEffectiveStatement createEffective(
50 final StmtContext<String, PresenceStatement, PresenceEffectiveStatement> ctx,
51 final PresenceStatement declared,
52 final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
53 return new RegularPresenceEffectiveStatement(declared, substatements);
57 protected PresenceEffectiveStatement createEmptyEffective(
58 final StmtContext<String, PresenceStatement, PresenceEffectiveStatement> ctx,
59 final PresenceStatement declared) {
60 return new EmptyPresenceEffectiveStatement(declared);