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%2FStringType.java;h=018ba00042d7ec27e9ee9c182c74ea56effdb98b;hb=1e9531138e44cd757ca27b0d86e98eccb22ccd82;hp=f58075bf307d9d6d2bd4f2012620dc4970426c7a;hpb=258cac6ec48a0a4ff62b33b4bdcbac5105a1e006;p=controller.git diff --git a/opendaylight/sal/yang-prototype/yang/yang-model-util/src/main/java/org/opendaylight/controller/yang/model/util/StringType.java b/opendaylight/sal/yang-prototype/yang/yang-model-util/src/main/java/org/opendaylight/controller/yang/model/util/StringType.java index f58075bf30..018ba00042 100644 --- a/opendaylight/sal/yang-prototype/yang/yang-model-util/src/main/java/org/opendaylight/controller/yang/model/util/StringType.java +++ b/opendaylight/sal/yang-prototype/yang/yang-model-util/src/main/java/org/opendaylight/controller/yang/model/util/StringType.java @@ -7,10 +7,8 @@ */ package org.opendaylight.controller.yang.model.util; -import java.net.URI; import java.util.ArrayList; import java.util.Collections; -import java.util.Date; import java.util.List; import org.opendaylight.controller.yang.common.QName; @@ -26,9 +24,9 @@ import org.opendaylight.controller.yang.model.api.type.StringTypeDefinition; * * @see StringTypeDefinition */ -public class StringType implements StringTypeDefinition { +public final class StringType implements StringTypeDefinition { - private final QName name = BaseTypes.constructQName("string");; + private final QName name = BaseTypes.constructQName("string"); private final SchemaPath path; private String defaultValue = ""; private final String description = ""; @@ -36,32 +34,43 @@ public class StringType implements StringTypeDefinition { private final List lengthStatements; private final List patterns; private String units = ""; + private final StringTypeDefinition baseType; + + private StringType() { + super(); + path = BaseTypes.schemaPath(name); + final List constraints = new ArrayList(); + constraints.add(BaseConstraints.lengthConstraint(0, Long.MAX_VALUE, "", "")); + lengthStatements = Collections.unmodifiableList(constraints); + patterns = Collections.emptyList(); + baseType = this; + } /** * Default Constructor. */ - public StringType(final List actualPath, - final URI namespace, final Date revision) { + public StringType(final SchemaPath path) { super(); - path = BaseTypes.schemaPath(actualPath, namespace, revision); + this.path = path; final List constraints = new ArrayList(); constraints.add(BaseConstraints.lengthConstraint(0, Long.MAX_VALUE, "", "")); lengthStatements = Collections.unmodifiableList(constraints); - - this.patterns = Collections.emptyList(); + patterns = Collections.emptyList(); + baseType = new StringType(); } /** * - * + * @param actualPath + * @param namespace + * @param revision * @param lengthStatements * @param patterns */ - public StringType(final List actualPath, - final URI namespace, final Date revision, final List lengthStatements, + public StringType(final SchemaPath path, final List lengthStatements, final List patterns) { super(); - path = BaseTypes.schemaPath(actualPath, namespace, revision); + this.path = path; if(lengthStatements == null || lengthStatements.size() == 0) { final List constraints = new ArrayList(); constraints.add(BaseConstraints.lengthConstraint(0, Long.MAX_VALUE, "", "")); @@ -70,6 +79,7 @@ public class StringType implements StringTypeDefinition { this.lengthStatements = Collections.unmodifiableList(lengthStatements); } this.patterns = Collections.unmodifiableList(patterns); + baseType = new StringType(); } /** @@ -80,12 +90,11 @@ public class StringType implements StringTypeDefinition { * @param patterns * @param units */ - public StringType(final List actualPath, - final URI namespace, final Date revision, final String defaultValue, + public StringType(final SchemaPath path, final String defaultValue, final List lengthStatements, final List patterns, final String units) { super(); - path = BaseTypes.schemaPath(actualPath, namespace, revision); + this.path = path; this.defaultValue = defaultValue; if(lengthStatements == null || lengthStatements.size() == 0) { final List constraints = new ArrayList(); @@ -94,8 +103,9 @@ public class StringType implements StringTypeDefinition { } else { this.lengthStatements = Collections.unmodifiableList(lengthStatements); } - this.patterns = patterns; + this.patterns = Collections.unmodifiableList(patterns); this.units = units; + this.baseType = new StringType(); } /* @@ -105,7 +115,7 @@ public class StringType implements StringTypeDefinition { */ @Override public StringTypeDefinition getBaseType() { - return this; + return baseType; } /*