Clean up TreeNode API
[yangtools.git] / model / yang-model-api / src / main / java / org / opendaylight / yangtools / yang / model / api / meta / StatementSourceReference.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 package org.opendaylight.yangtools.yang.model.api.meta;
9
10 import org.eclipse.jdt.annotation.NonNull;
11 import org.eclipse.jdt.annotation.Nullable;
12 import org.opendaylight.yangtools.concepts.Immutable;
13
14 /**
15  * Reference of statement source. Statement source reference serves to provide information, why a statement was defined
16  * and introduced in model.
17  *
18  * <p>
19  * Reasons for introduction of statement could be various, but most obvious one is explicit declaration in model source
20  * text.
21  */
22 public abstract class StatementSourceReference implements Immutable {
23     /**
24      * Returns the {@link StatementOrigin} associated with this reference.
25      *
26      * @return {@link StatementOrigin#DECLARATION} if statement was explicitly declared in YANG model source,
27      *         {@link StatementOrigin#CONTEXT} if statement was inferred.
28      */
29     public abstract @NonNull StatementOrigin statementOrigin();
30
31     /**
32      * Returns the {@link DeclarationReference} associated with this reference, if available.
33      *
34      * @return A {@link DeclarationReference} or null.
35      */
36     public abstract @Nullable DeclarationReference declarationReference();
37
38     /**
39      * Returns human readable representation of statement source.
40      *
41      * <p>
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.
44      *
45      * @return human readable representation of statement source.
46      */
47     @Override
48     public abstract @NonNull String toString();
49 }