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=312bb4a1db22b7384f35cf79b7511b4e0b4da346;hb=707e2aa73c7314180472539ed4137950d33f5776;hp=0857ec6f8da64e16e64119d44d78834fd477cb9c;hpb=21187101470327eece6ffa2404f3c12f0ea6f0cd;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 0857ec6f8d..312bb4a1db 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,8 +7,9 @@ */ package org.opendaylight.controller.config.yangjmxgenerator.plugin.ftl.model; -import com.google.common.collect.Lists; +import static com.google.common.base.Preconditions.checkNotNull; +import com.google.common.collect.Lists; import java.util.List; public class Field { @@ -16,31 +17,50 @@ public class Field { 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 +76,9 @@ public class Field { public boolean isArray() { return type.endsWith("[]"); } + + @Override + public String toString() { + return FieldSerializer.toString(this); + } }