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 {
private final String reference;
private final List<UnknownSchemaNode> unknownSchemaNodes;
+ private List<RangeConstraint> ranges = Collections.emptyList();
+ private List<LengthConstraint> lengths = Collections.emptyList();
+ private List<PatternConstraint> patterns = Collections.emptyList();
+ private Integer fractionDigits = null;
+
+
private Status status;
private String units;
private Object defaultValue;
private String units = "";
private Object defaultValue = null;
+ private List<RangeConstraint> ranges = Collections.emptyList();
+ private List<LengthConstraint> lengths = Collections.emptyList();
+ private List<PatternConstraint> patterns = Collections.emptyList();
+ private Integer fractionDigits = null;
+
public Builder(final QName typeName, TypeDefinition<?> baseType,
final String description, final String reference) {
this.typeName = typeName;
return this;
}
+ public Builder ranges(final List<RangeConstraint> ranges) {
+ if(ranges != null) {
+ this.ranges = ranges;
+ }
+ return this;
+ }
+
+ public Builder lengths(final List<LengthConstraint> lengths) {
+ if(lengths != null) {
+ this.lengths = lengths;
+ }
+ return this;
+ }
+
+ public Builder patterns(final List<PatternConstraint> 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);
}
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
builder2.append("]");
return builder2.toString();
}
+
+ public List<RangeConstraint> getRanges() {
+ return ranges;
+ }
+
+ public List<LengthConstraint> getLengths() {
+ return lengths;
+ }
+
+ public List<PatternConstraint> getPatterns() {
+ return patterns;
+ }
+
+ public Integer getFractionDigits() {
+ return fractionDigits;
+ }
}