X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?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;hb=26d2f331053e05d830c74196fb46b90379e47492;hp=fe9e885b6fab8edcc457008b479f534512073386;hpb=2202c2e0c5e65783b02254a7cfc2b1fb6d84afe9;p=controller.git 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 fe9e885b6f..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 @@ -7,36 +7,61 @@ */ package org.opendaylight.controller.config.yangjmxgenerator.plugin.ftl.model; +import com.google.common.collect.Lists; + import java.util.List; -import com.google.common.collect.Lists; +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, 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; } @@ -52,4 +77,9 @@ public class Field { public boolean isArray() { return type.endsWith("[]"); } + + @Override + public String toString() { + return FieldSerializer.toString(this); + } }