59c3dfdf7787e4f4c7e5d9c801a2435a82a93a39
[yangtools.git] / yang / yang-parser-spi / src / main / java / org / opendaylight / yangtools / yang / parser / spi / source / 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.parser.spi.source;
9
10 import org.eclipse.jdt.annotation.NonNull;
11 import org.opendaylight.yangtools.yang.model.api.meta.StatementSource;
12
13 /**
14  * Reference of statement source. Statement source reference serves to provide information, why a statement was defined
15  * and introduced in model.
16  *
17  * <p>
18  * Reasons for introduction of statement could be various, but most obvious one is explicit declaration in model source
19  * text such as {@link DeclarationInTextSource}.
20  */
21 public interface StatementSourceReference {
22     /**
23      * Returns source type.
24      *
25      * @return {@link StatementSource#DECLARATION} if statement was explicitly declared in YANG model source,
26      *         {@link StatementSource#CONTEXT} if statement was inferred.
27      */
28     @NonNull StatementSource getStatementSource();
29
30     /**
31      * Returns human readable representation of statement source.
32      *
33      * <p>
34      * Implementations of this interface should override {@link #toString()}, since it may be used in error reporting
35      * to provide context information for model designer to debug errors in its mode.
36      *
37      * @return human readable representation of statement source.
38      */
39     @Override
40     String toString();
41 }