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.model.api.meta;
10 import org.eclipse.jdt.annotation.NonNull;
11 import org.eclipse.jdt.annotation.Nullable;
12 import org.opendaylight.yangtools.concepts.Immutable;
15 * Reference of statement source. Statement source reference serves to provide information, why a statement was defined
16 * and introduced in model.
19 * Reasons for introduction of statement could be various, but most obvious one is explicit declaration in model source
22 public abstract class StatementSourceReference implements Immutable {
24 * Returns the {@link StatementOrigin} associated with this reference.
26 * @return {@link StatementOrigin#DECLARATION} if statement was explicitly declared in YANG model source,
27 * {@link StatementOrigin#CONTEXT} if statement was inferred.
29 public abstract @NonNull StatementOrigin statementOrigin();
32 * Returns the {@link DeclarationReference} associated with this reference, if available.
34 * @return A {@link DeclarationReference} or null.
36 public abstract @Nullable DeclarationReference declarationReference();
39 * Returns human readable representation of statement source.
42 * Implementations of this interface should override {@link #toString()}, since it may be used in error reporting
43 * to provide context information for model designer to debug errors in its mode.
45 * @return human readable representation of statement source.
48 public abstract @NonNull String toString();