X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fconfig%2Fyang-jmx-generator-plugin%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fconfig%2Fyangjmxgenerator%2Fplugin%2Fftl%2Fmodel%2FField.java;h=3639b6d727274d9656c24a04cd62e09a7a3ae62a;hp=0857ec6f8da64e16e64119d44d78834fd477cb9c;hb=b23703bef6c3aaafe2dc83608a03b738ad42f945;hpb=616a88111ea9603f0d6f93c7462e6dab39644fcf diff --git a/opendaylight/config/yang-jmx-generator-plugin/src/main/java/org/opendaylight/controller/config/yangjmxgenerator/plugin/ftl/model/Field.java b/opendaylight/config/yang-jmx-generator-plugin/src/main/java/org/opendaylight/controller/config/yangjmxgenerator/plugin/ftl/model/Field.java index 0857ec6f8d..3639b6d727 100644 --- a/opendaylight/config/yang-jmx-generator-plugin/src/main/java/org/opendaylight/controller/config/yangjmxgenerator/plugin/ftl/model/Field.java +++ b/opendaylight/config/yang-jmx-generator-plugin/src/main/java/org/opendaylight/controller/config/yangjmxgenerator/plugin/ftl/model/Field.java @@ -11,36 +11,57 @@ import com.google.common.collect.Lists; import java.util.List; +import static com.google.common.base.Preconditions.checkNotNull; + public class Field { private final String type; private final String name; private final String definition; private final List modifiers; + private final boolean needsDepResolver; public Field(String type, String name) { - this(Lists. newArrayList(), type, name, null); + this(Lists. newArrayList(), type, name, null, false); } public Field(String type, String name, String definition) { - this(Lists. newArrayList(), type, name, definition); + this(Lists. newArrayList(), type, name, definition, false); } public Field(List modifiers, String type, String name) { - this(modifiers, type, name, null); + this(modifiers, type, name, null, false); } public Field(List modifiers, String type, String name, String definition) { - this.modifiers = modifiers; - this.type = type; - this.name = name; - this.definition = definition; + this(modifiers, type, name, definition, false); + } + + public Field(List modifiers, String type, String name, + String nullableDefinition, boolean needsDepResolver) { + this.modifiers = checkNotNull(modifiers); + this.type = checkNotNull(type); + this.name = checkNotNull(name); + this.definition = nullableDefinition; + this.needsDepResolver = needsDepResolver; + } + + public Field(String type, String name, String definition, boolean needsDepResolver) { + this(Lists. newArrayList(), type, name, definition, needsDepResolver); + } + + public boolean isNeedsDepResolver() { + return needsDepResolver; } public String getType() { return type; } + public String getGenericInnerType() { + return type.substring(type.indexOf("<") + 1, type.indexOf(">")); + } + public List getModifiers() { return modifiers; } @@ -56,4 +77,9 @@ public class Field { public boolean isArray() { return type.endsWith("[]"); } + + @Override + public String toString() { + return FieldSerializer.toString(this); + } }