Implemented ordering of yang module data nodes. Added Comparators utility class.
[controller.git] / opendaylight / sal / yang-prototype / code-generator / yang-model-parser-impl / src / main / java / org / opendaylight / controller / yang / parser / builder / api / AbstractTypeAwareBuilder.java
1 /*
2  * Copyright (c) 2013 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.controller.yang.parser.builder.api;
9
10 import org.opendaylight.controller.yang.common.QName;
11 import org.opendaylight.controller.yang.model.api.TypeDefinition;
12
13 /**
14  * Basic implementation for TypeAwareBuilder builders.
15  */
16 public abstract class AbstractTypeAwareBuilder implements TypeAwareBuilder {
17     protected final int line;
18     protected final QName qname;
19     protected Builder parent;
20     protected TypeDefinition<?> type;
21     protected TypeDefinitionBuilder typedef;
22
23     public AbstractTypeAwareBuilder(final int line, final QName qname) {
24         this.line = line;
25         this.qname = qname;
26     }
27
28     @Override
29     public int getLine() {
30         return line;
31     }
32
33     @Override
34     public Builder getParent() {
35         return parent;
36     }
37
38     @Override
39     public void setParent(final Builder parent) {
40         this.parent = parent;
41     }
42
43     @Override
44     public QName getQName() {
45         return qname;
46     }
47
48     @Override
49     public TypeDefinition<?> getType() {
50         return type;
51     }
52
53     @Override
54     public TypeDefinitionBuilder getTypedef() {
55         return typedef;
56     }
57
58     @Override
59     public void setType(TypeDefinition<?> type) {
60         this.type = type;
61         this.typedef = null;
62     }
63
64     @Override
65     public void setTypedef(TypeDefinitionBuilder typedef) {
66         this.typedef = typedef;
67         this.type = null;
68     }
69
70 }