89792a3e60b1f79e901f3b9f86b83392ba7057db
[yangtools.git] / yang / yang-parser-impl / src / main / java / org / opendaylight / yangtools / yang / parser / spi / meta / ModelProcessingPhase.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.meta;
9
10 import javax.annotation.Nullable;
11
12 public enum ModelProcessingPhase {
13     INIT(null),
14     /**
15      *
16      * Preliminary cross-source relationship resolution phase which collects
17      * available module names and module namespaces. It is necessary in order to
18      * correct resolution of unknown statements used in linkage phase (e.g.
19      * openconfig version of yang modules).
20      */
21     SOURCE_PRE_LINKAGE(INIT),
22     /**
23      *
24      * Cross-source relationship resolution phase.
25      * <p>
26      * In this phase of processing only statements which affects cross-source
27      * relationship (e.g. imports / includes) are processed.
28      * <p>
29      * At end of this phase all source related contexts should be bind to their
30      * imports and includes to allow visibility of custom defined statements in
31      * following phases.
32      */
33     SOURCE_LINKAGE(SOURCE_PRE_LINKAGE),
34     STATEMENT_DEFINITION(SOURCE_LINKAGE),
35     FULL_DECLARATION(STATEMENT_DEFINITION),
36     EFFECTIVE_MODEL(FULL_DECLARATION);
37
38     private final ModelProcessingPhase previousPhase;
39
40     ModelProcessingPhase(@Nullable ModelProcessingPhase previous) {
41         this.previousPhase = previous;
42     }
43
44     public ModelProcessingPhase getPreviousPhase() {
45         return previousPhase;
46     }
47 }