Merge branch 'master' of ../controller
[yangtools.git] / yang / yang-parser-spi / 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 edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
11 import org.eclipse.jdt.annotation.NonNullByDefault;
12 import org.eclipse.jdt.annotation.Nullable;
13
14 @NonNullByDefault
15 @SuppressFBWarnings("NP_NULL_PARAM_DEREF_NONVIRTUAL")
16 public enum ModelProcessingPhase {
17     INIT(null),
18
19     /**
20      * Preliminary cross-source relationship resolution phase which collects available module names and module
21      * namespaces. It is necessary in order to correct resolution of unknown statements used in linkage phase (e.g.
22      * semantic version of yang modules).
23      */
24     SOURCE_PRE_LINKAGE(INIT),
25
26     /**
27      * Cross-source relationship resolution phase.
28      *
29      * <p>
30      * In this phase of processing only statements which affects cross-source relationship (e.g. imports / includes)
31      * are processed.
32      *
33      * <p>
34      * At end of this phase all source related contexts should be bind to their imports and includes to allow
35      * visibility of custom defined statements in subsequent phases.
36      */
37     SOURCE_LINKAGE(SOURCE_PRE_LINKAGE),
38     STATEMENT_DEFINITION(SOURCE_LINKAGE),
39     FULL_DECLARATION(STATEMENT_DEFINITION),
40     EFFECTIVE_MODEL(FULL_DECLARATION);
41
42     private final @Nullable ModelProcessingPhase previousPhase;
43
44     ModelProcessingPhase(final @Nullable ModelProcessingPhase previous) {
45         this.previousPhase = previous;
46     }
47
48     public @Nullable ModelProcessingPhase getPreviousPhase() {
49         return previousPhase;
50     }
51 }