ad5cbb287c73a4aef2cafebce6afb442f57fd1ed
[controller.git] / opendaylight / config / yang-jmx-generator-plugin / src / main / java / org / opendaylight / controller / config / yangjmxgenerator / plugin / ftl / model / Field.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.config.yangjmxgenerator.plugin.ftl.model;
9
10 import com.google.common.collect.Lists;
11
12 import java.util.List;
13
14 public class Field {
15     private final String type;
16     private final String name;
17     private final String definition;
18     private final List<String> modifiers;
19     private final boolean needsDepResolver;
20
21     public Field(String type, String name) {
22         this(Lists.<String> newArrayList(), type, name, null, false);
23     }
24
25     public Field(String type, String name, String definition) {
26         this(Lists.<String> newArrayList(), type, name, definition, false);
27     }
28
29     public Field(List<String> modifiers, String type, String name) {
30         this(modifiers, type, name, null, false);
31     }
32
33     public Field(List<String> modifiers, String type, String name,
34             String definition) {
35         this(modifiers, type, name, definition, false);
36     }
37
38     public Field(List<String> modifiers, String type, String name,
39             String definition, boolean needsDepResolver) {
40         this.modifiers = modifiers;
41         this.type = type;
42         this.name = name;
43         this.definition = definition;
44         this.needsDepResolver = needsDepResolver;
45     }
46
47     public Field(String type, String name, String definition, boolean needsDepResolver) {
48         this(Lists.<String> newArrayList(), type, name, definition, needsDepResolver);
49     }
50
51     public boolean isNeedsDepResolver() {
52         return needsDepResolver;
53     }
54
55     public String getType() {
56         return type;
57     }
58
59     public List<String> getModifiers() {
60         return modifiers;
61     }
62
63     public String getName() {
64         return name;
65     }
66
67     public String getDefinition() {
68         return definition;
69     }
70
71     public boolean isArray() {
72         return type.endsWith("[]");
73     }
74 }