X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fsal%2Fyang-prototype%2Fyang%2Fyang-model-util%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fyang%2Fmodel%2Futil%2FExtendedType.java;h=03f06387f1d70a251c82510dbdc5ec61dd3d1a95;hb=6e72d221f55cfac71ee6e594b62cb5af9672614a;hp=c82df2e079cfaa98a1bb70119ebc2860c80c4851;hpb=4ce0f6630bc576b97c8c9a08848aafb6e90a75b0;p=controller.git diff --git a/opendaylight/sal/yang-prototype/yang/yang-model-util/src/main/java/org/opendaylight/controller/yang/model/util/ExtendedType.java b/opendaylight/sal/yang-prototype/yang/yang-model-util/src/main/java/org/opendaylight/controller/yang/model/util/ExtendedType.java index c82df2e079..03f06387f1 100644 --- a/opendaylight/sal/yang-prototype/yang/yang-model-util/src/main/java/org/opendaylight/controller/yang/model/util/ExtendedType.java +++ b/opendaylight/sal/yang-prototype/yang/yang-model-util/src/main/java/org/opendaylight/controller/yang/model/util/ExtendedType.java @@ -15,6 +15,9 @@ import org.opendaylight.controller.yang.model.api.SchemaPath; import org.opendaylight.controller.yang.model.api.Status; import org.opendaylight.controller.yang.model.api.TypeDefinition; import org.opendaylight.controller.yang.model.api.UnknownSchemaNode; +import org.opendaylight.controller.yang.model.api.type.LengthConstraint; +import org.opendaylight.controller.yang.model.api.type.PatternConstraint; +import org.opendaylight.controller.yang.model.api.type.RangeConstraint; public class ExtendedType implements TypeDefinition { @@ -25,6 +28,12 @@ public class ExtendedType implements TypeDefinition { private final String reference; private final List unknownSchemaNodes; + private List ranges = Collections.emptyList(); + private List lengths = Collections.emptyList(); + private List patterns = Collections.emptyList(); + private Integer fractionDigits = null; + + private Status status; private String units; private Object defaultValue; @@ -42,6 +51,11 @@ public class ExtendedType implements TypeDefinition { private String units = ""; private Object defaultValue = null; + private List ranges = Collections.emptyList(); + private List lengths = Collections.emptyList(); + private List patterns = Collections.emptyList(); + private Integer fractionDigits = null; + public Builder(final QName typeName, TypeDefinition baseType, final String description, final String reference) { this.typeName = typeName; @@ -71,6 +85,32 @@ public class ExtendedType implements TypeDefinition { return this; } + public Builder ranges(final List ranges) { + if(ranges != null) { + this.ranges = ranges; + } + return this; + } + + public Builder lengths(final List lengths) { + if(lengths != null) { + this.lengths = lengths; + } + return this; + } + + public Builder patterns(final List patterns) { + if(patterns != null) { + this.patterns = patterns; + } + return this; + } + + public Builder fractionDigits(final Integer fractionDigits) { + this.fractionDigits = fractionDigits; + return this; + } + public ExtendedType build() { return new ExtendedType(this); } @@ -86,6 +126,11 @@ public class ExtendedType implements TypeDefinition { this.status = builder.status; this.units = builder.units; this.defaultValue = builder.defaultValue; + + this.ranges = builder.ranges; + this.lengths = builder.lengths; + this.patterns = builder.patterns; + this.fractionDigits = builder.fractionDigits; } @Override @@ -253,4 +298,20 @@ public class ExtendedType implements TypeDefinition { builder2.append("]"); return builder2.toString(); } + + public List getRanges() { + return ranges; + } + + public List getLengths() { + return lengths; + } + + public List getPatterns() { + return patterns; + } + + public Integer getFractionDigits() { + return fractionDigits; + } }