/* * Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v1.0 which accompanies this distribution, * and is available at http://www.eclipse.org/legal/epl-v10.html */ package org.opendaylight.yangtools.yang.parser.rfc7950.stmt; import java.util.Optional; import org.eclipse.jdt.annotation.NonNull; import org.opendaylight.yangtools.yang.model.api.DocumentedNode; import org.opendaylight.yangtools.yang.model.api.Status; import org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement; import org.opendaylight.yangtools.yang.model.api.stmt.DescriptionEffectiveStatement; import org.opendaylight.yangtools.yang.model.api.stmt.ReferenceEffectiveStatement; import org.opendaylight.yangtools.yang.model.api.stmt.StatusEffectiveStatement; import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext; public abstract class AbstractEffectiveDocumentedNode> extends DeclaredEffectiveStatementBase implements DocumentedNode.WithStatus { private final String description; private final String reference; private final @NonNull Status status; /** * Constructor. * * @param ctx * context of statement. */ protected AbstractEffectiveDocumentedNode(final StmtContext ctx) { super(ctx); description = findFirstEffectiveSubstatementArgument(DescriptionEffectiveStatement.class).orElse(null); reference = findFirstEffectiveSubstatementArgument(ReferenceEffectiveStatement.class).orElse(null); status = findFirstEffectiveSubstatementArgument(StatusEffectiveStatement.class).orElse(Status.CURRENT); } @Override public final Optional getDescription() { return Optional.ofNullable(description); } @Override public final Optional getReference() { return Optional.ofNullable(reference); } @Override public final Status getStatus() { return status; } }