Updated YANG Type definitions and documentation in YANG Model Utils. 83/83/1
authorLukas Sedlak <lsedlak@cisco.com>
Thu, 28 Mar 2013 12:58:52 +0000 (13:58 +0100)
committerTony Tkacik <ttkacik@cisco.com>
Thu, 28 Mar 2013 12:58:52 +0000 (13:58 +0100)
Splitted Integer Type into Unsigned and Signed Integer Type.
Updated documentation.

Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
25 files changed:
opendaylight/sal/yang-prototype/yang/yang-model-util/src/main/java/org/opendaylight/controller/model/util/AbstractSignedInteger.java [moved from opendaylight/sal/yang-prototype/yang/yang-model-util/src/main/java/org/opendaylight/controller/model/util/AbstractInteger.java with 71% similarity]
opendaylight/sal/yang-prototype/yang/yang-model-util/src/main/java/org/opendaylight/controller/model/util/AbstractUnsignedInteger.java [new file with mode: 0644]
opendaylight/sal/yang-prototype/yang/yang-model-util/src/main/java/org/opendaylight/controller/model/util/BaseConstraints.java
opendaylight/sal/yang-prototype/yang/yang-model-util/src/main/java/org/opendaylight/controller/model/util/BaseTypes.java
opendaylight/sal/yang-prototype/yang/yang-model-util/src/main/java/org/opendaylight/controller/model/util/BinaryType.java
opendaylight/sal/yang-prototype/yang/yang-model-util/src/main/java/org/opendaylight/controller/model/util/BitsType.java
opendaylight/sal/yang-prototype/yang/yang-model-util/src/main/java/org/opendaylight/controller/model/util/BooleanType.java
opendaylight/sal/yang-prototype/yang/yang-model-util/src/main/java/org/opendaylight/controller/model/util/Decimal64.java
opendaylight/sal/yang-prototype/yang/yang-model-util/src/main/java/org/opendaylight/controller/model/util/EnumerationType.java
opendaylight/sal/yang-prototype/yang/yang-model-util/src/main/java/org/opendaylight/controller/model/util/IdentityType.java
opendaylight/sal/yang-prototype/yang/yang-model-util/src/main/java/org/opendaylight/controller/model/util/Identityref.java
opendaylight/sal/yang-prototype/yang/yang-model-util/src/main/java/org/opendaylight/controller/model/util/InstanceIdentifier.java
opendaylight/sal/yang-prototype/yang/yang-model-util/src/main/java/org/opendaylight/controller/model/util/Int16.java
opendaylight/sal/yang-prototype/yang/yang-model-util/src/main/java/org/opendaylight/controller/model/util/Int32.java
opendaylight/sal/yang-prototype/yang/yang-model-util/src/main/java/org/opendaylight/controller/model/util/Int64.java
opendaylight/sal/yang-prototype/yang/yang-model-util/src/main/java/org/opendaylight/controller/model/util/Int8.java
opendaylight/sal/yang-prototype/yang/yang-model-util/src/main/java/org/opendaylight/controller/model/util/Leafref.java
opendaylight/sal/yang-prototype/yang/yang-model-util/src/main/java/org/opendaylight/controller/model/util/RevisionAwareXPathImpl.java
opendaylight/sal/yang-prototype/yang/yang-model-util/src/main/java/org/opendaylight/controller/model/util/StringType.java
opendaylight/sal/yang-prototype/yang/yang-model-util/src/main/java/org/opendaylight/controller/model/util/Uint16.java
opendaylight/sal/yang-prototype/yang/yang-model-util/src/main/java/org/opendaylight/controller/model/util/Uint32.java
opendaylight/sal/yang-prototype/yang/yang-model-util/src/main/java/org/opendaylight/controller/model/util/Uint64.java
opendaylight/sal/yang-prototype/yang/yang-model-util/src/main/java/org/opendaylight/controller/model/util/Uint8.java
opendaylight/sal/yang-prototype/yang/yang-model-util/src/main/java/org/opendaylight/controller/model/util/UnknownType.java
opendaylight/sal/yang-prototype/yang/yang-model-util/src/main/java/org/opendaylight/controller/model/util/YangTypesConverter.java

-/*\r
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.controller.model.util;\r
-\r
-import java.util.Collections;\r
-import java.util.List;\r
-\r
-import org.opendaylight.controller.model.api.type.IntegerTypeDefinition;\r
-import org.opendaylight.controller.model.api.type.RangeConstraint;\r
-import org.opendaylight.controller.yang.common.QName;\r
-import org.opendaylight.controller.yang.model.api.SchemaPath;\r
-import org.opendaylight.controller.yang.model.api.Status;\r
-import org.opendaylight.controller.yang.model.api.UnknownSchemaNode;\r
-\r
-public abstract class AbstractInteger implements IntegerTypeDefinition {\r
-\r
-    private final QName name;\r
-    private final SchemaPath path;\r
-\r
-    private final String description;\r
-    private final String reference;\r
-\r
-    private String units = "";\r
-    private final List<RangeConstraint> rangeStatements;\r
-\r
-    public AbstractInteger(final QName name, final String description,\r
-            final String reference) {\r
-        super();\r
-        this.name = name;\r
-        this.description = description;\r
-        this.reference = reference;\r
-        this.path = BaseTypes.schemaPath(name);\r
-\r
-        final List<? extends RangeConstraint> emptyContstraints = Collections\r
-                .emptyList();\r
-        this.rangeStatements = Collections.unmodifiableList(emptyContstraints);\r
-    }\r
-\r
-    public AbstractInteger(QName name, String description, String reference,\r
-            List<RangeConstraint> rangeStatements) {\r
-        super();\r
-        this.name = name;\r
-        this.description = description;\r
-        this.reference = reference;\r
-        this.rangeStatements = rangeStatements;\r
-        this.path = BaseTypes.schemaPath(name);\r
-    }\r
-\r
-    public AbstractInteger(QName name, String description, String reference,\r
-            String units) {\r
-        super();\r
-        this.name = name;\r
-        this.description = description;\r
-        this.reference = reference;\r
-        this.units = units;\r
-        this.path = BaseTypes.schemaPath(name);\r
-\r
-        final List<? extends RangeConstraint> emptyContstraints = Collections\r
-                .emptyList();\r
-        this.rangeStatements = Collections.unmodifiableList(emptyContstraints);\r
-    }\r
-\r
-    public AbstractInteger(QName name, String description, String reference,\r
-            String units, List<RangeConstraint> rangeStatements) {\r
-        super();\r
-        this.name = name;\r
-        this.description = description;\r
-        this.reference = reference;\r
-        this.units = units;\r
-        this.rangeStatements = rangeStatements;\r
-        this.path = BaseTypes.schemaPath(name);\r
-    }\r
-\r
-    @Override\r
-    public String getUnits() {\r
-        return units;\r
-    }\r
-\r
-    @Override\r
-    public QName getQName() {\r
-        return name;\r
-    }\r
-\r
-    @Override\r
-    public SchemaPath getPath() {\r
-        return path;\r
-    }\r
-\r
-    @Override\r
-    public String getDescription() {\r
-        return description;\r
-    }\r
-\r
-    @Override\r
-    public String getReference() {\r
-        return reference;\r
-    }\r
-\r
-    @Override\r
-    public Status getStatus() {\r
-        return Status.CURRENT;\r
-    }\r
-\r
-    @Override\r
-    public List<RangeConstraint> getRangeStatements() {\r
-        return rangeStatements;\r
-    }\r
-\r
-    @Override\r
-    public List<UnknownSchemaNode> getUnknownSchemaNodes() {\r
-        return Collections.emptyList();\r
-    }\r
-\r
-    @Override\r
-    public int hashCode() {\r
-        final int prime = 31;\r
-        int result = 1;\r
-        result = prime * result\r
-                + ((description == null) ? 0 : description.hashCode());\r
-        result = prime * result + ((name == null) ? 0 : name.hashCode());\r
-        result = prime * result + ((path == null) ? 0 : path.hashCode());\r
-        result = prime * result\r
-                + ((rangeStatements == null) ? 0 : rangeStatements.hashCode());\r
-        result = prime * result\r
-                + ((reference == null) ? 0 : reference.hashCode());\r
-        result = prime * result + ((units == null) ? 0 : units.hashCode());\r
-        return result;\r
-    }\r
-\r
-    @Override\r
-    public boolean equals(Object obj) {\r
-        if (this == obj) {\r
-            return true;\r
-        }\r
-        if (obj == null) {\r
-            return false;\r
-        }\r
-        if (getClass() != obj.getClass()) {\r
-            return false;\r
-        }\r
-        AbstractInteger other = (AbstractInteger) obj;\r
-        if (description == null) {\r
-            if (other.description != null) {\r
-                return false;\r
-            }\r
-        } else if (!description.equals(other.description)) {\r
-            return false;\r
-        }\r
-        if (name == null) {\r
-            if (other.name != null) {\r
-                return false;\r
-            }\r
-        } else if (!name.equals(other.name)) {\r
-            return false;\r
-        }\r
-        if (path == null) {\r
-            if (other.path != null) {\r
-                return false;\r
-            }\r
-        } else if (!path.equals(other.path)) {\r
-            return false;\r
-        }\r
-        if (rangeStatements == null) {\r
-            if (other.rangeStatements != null) {\r
-                return false;\r
-            }\r
-        } else if (!rangeStatements.equals(other.rangeStatements)) {\r
-            return false;\r
-        }\r
-        if (reference == null) {\r
-            if (other.reference != null) {\r
-                return false;\r
-            }\r
-        } else if (!reference.equals(other.reference)) {\r
-            return false;\r
-        }\r
-        if (units == null) {\r
-            if (other.units != null) {\r
-                return false;\r
-            }\r
-        } else if (!units.equals(other.units)) {\r
-            return false;\r
-        }\r
-        return true;\r
-    }\r
-\r
-    @Override\r
-    public String toString() {\r
-        StringBuilder builder = new StringBuilder();\r
-        builder.append("AbstractInteger [name=");\r
-        builder.append(name);\r
-        builder.append(", path=");\r
-        builder.append(path);\r
-        builder.append(", description=");\r
-        builder.append(description);\r
-        builder.append(", reference=");\r
-        builder.append(reference);\r
-        builder.append(", units=");\r
-        builder.append(units);\r
-        builder.append(", rangeStatements=");\r
-        builder.append(rangeStatements);\r
-        builder.append("]");\r
-        return builder.toString();\r
-    }\r
-}\r
+/*
+ * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.controller.model.util;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.opendaylight.controller.model.api.type.IntegerTypeDefinition;
+import org.opendaylight.controller.model.api.type.RangeConstraint;
+import org.opendaylight.controller.yang.common.QName;
+import org.opendaylight.controller.yang.model.api.SchemaPath;
+import org.opendaylight.controller.yang.model.api.Status;
+import org.opendaylight.controller.yang.model.api.UnknownSchemaNode;
+
+/**
+ * The Abstract Integer class defines implementation of IntegerTypeDefinition
+ * interface which represents SIGNED Integer values defined in Yang language. <br>
+ * The integer built-in types in Yang are int8, int16, int32, int64. They
+ * represent signed integers of different sizes:
+ * 
+ * <ul>
+ * <li>int8 - represents integer values between -128 and 127, inclusively.</li>
+ * <li>int16 - represents integer values between -32768 and 32767, inclusively.</li>
+ * <li>int32 - represents integer values between -2147483648 and 2147483647,
+ * inclusively.</li>
+ * <li>int64 - represents integer values between -9223372036854775808 and
+ * 9223372036854775807, inclusively.</li>
+ * </ul>
+ * 
+ */
+public abstract class AbstractSignedInteger implements IntegerTypeDefinition {
+
+    private final QName name;
+    private final SchemaPath path;
+    private final String description;
+    private final String reference = "https://tools.ietf.org/html/rfc6020#section-9.2";
+
+    private final String units;
+    private final List<RangeConstraint> rangeStatements;
+
+    /**
+     * @param name
+     * @param description
+     * @param minRange
+     * @param maxRange
+     * @param units
+     */
+    public AbstractSignedInteger(final QName name, final String description,
+            final Number minRange, final Number maxRange, final String units) {
+        this.name = name;
+        this.description = description;
+        this.path = BaseTypes.schemaPath(name);
+        this.units = units;
+        this.rangeStatements = new ArrayList<RangeConstraint>();
+        final String rangeDescription = "Integer values between " + minRange
+                + " and " + maxRange + ", inclusively.";
+        this.rangeStatements.add(BaseConstraints.rangeConstraint(minRange,
+                maxRange, rangeDescription, "https://tools.ietf.org/html/rfc6020#section-9.2.4"));
+    }
+
+    /**
+     * @param name
+     * @param description
+     * @param rangeStatements
+     * @param units
+     */
+    public AbstractSignedInteger(final QName name, final String description,
+            final List<RangeConstraint> rangeStatements, final String units) {
+        this.name = name;
+        this.description = description;
+        this.path = BaseTypes.schemaPath(name);
+        this.units = units;
+        this.rangeStatements = rangeStatements;
+    }
+
+    @Override
+    public String getUnits() {
+        return units;
+    }
+
+    @Override
+    public QName getQName() {
+        return name;
+    }
+
+    @Override
+    public SchemaPath getPath() {
+        return path;
+    }
+
+    @Override
+    public String getDescription() {
+        return description;
+    }
+
+    @Override
+    public String getReference() {
+        return reference;
+    }
+
+    @Override
+    public Status getStatus() {
+        return Status.CURRENT;
+    }
+
+    @Override
+    public List<RangeConstraint> getRangeStatements() {
+        return rangeStatements;
+    }
+
+    @Override
+    public List<UnknownSchemaNode> getUnknownSchemaNodes() {
+        return Collections.emptyList();
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result
+                + ((description == null) ? 0 : description.hashCode());
+        result = prime * result + ((name == null) ? 0 : name.hashCode());
+        result = prime * result + ((path == null) ? 0 : path.hashCode());
+        result = prime * result
+                + ((rangeStatements == null) ? 0 : rangeStatements.hashCode());
+        result = prime * result
+                + ((reference == null) ? 0 : reference.hashCode());
+        result = prime * result + ((units == null) ? 0 : units.hashCode());
+        return result;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj == null) {
+            return false;
+        }
+        if (getClass() != obj.getClass()) {
+            return false;
+        }
+        AbstractSignedInteger other = (AbstractSignedInteger) obj;
+        if (description == null) {
+            if (other.description != null) {
+                return false;
+            }
+        } else if (!description.equals(other.description)) {
+            return false;
+        }
+        if (name == null) {
+            if (other.name != null) {
+                return false;
+            }
+        } else if (!name.equals(other.name)) {
+            return false;
+        }
+        if (path == null) {
+            if (other.path != null) {
+                return false;
+            }
+        } else if (!path.equals(other.path)) {
+            return false;
+        }
+        if (rangeStatements == null) {
+            if (other.rangeStatements != null) {
+                return false;
+            }
+        } else if (!rangeStatements.equals(other.rangeStatements)) {
+            return false;
+        }
+        if (reference == null) {
+            if (other.reference != null) {
+                return false;
+            }
+        } else if (!reference.equals(other.reference)) {
+            return false;
+        }
+        if (units == null) {
+            if (other.units != null) {
+                return false;
+            }
+        } else if (!units.equals(other.units)) {
+            return false;
+        }
+        return true;
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder builder = new StringBuilder();
+        builder.append("AbstractInteger [name=");
+        builder.append(name);
+        builder.append(", path=");
+        builder.append(path);
+        builder.append(", description=");
+        builder.append(description);
+        builder.append(", reference=");
+        builder.append(reference);
+        builder.append(", units=");
+        builder.append(units);
+        builder.append(", rangeStatements=");
+        builder.append(rangeStatements);
+        builder.append("]");
+        return builder.toString();
+    }
+}
diff --git a/opendaylight/sal/yang-prototype/yang/yang-model-util/src/main/java/org/opendaylight/controller/model/util/AbstractUnsignedInteger.java b/opendaylight/sal/yang-prototype/yang/yang-model-util/src/main/java/org/opendaylight/controller/model/util/AbstractUnsignedInteger.java
new file mode 100644 (file)
index 0000000..86c543e
--- /dev/null
@@ -0,0 +1,209 @@
+/**
+ * 
+ */
+package org.opendaylight.controller.model.util;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.opendaylight.controller.model.api.type.RangeConstraint;
+import org.opendaylight.controller.model.api.type.UnsignedIntegerTypeDefinition;
+import org.opendaylight.controller.yang.common.QName;
+import org.opendaylight.controller.yang.model.api.SchemaPath;
+import org.opendaylight.controller.yang.model.api.Status;
+import org.opendaylight.controller.yang.model.api.UnknownSchemaNode;
+
+/**
+ * The Abstract Integer class defines implementation of IntegerTypeDefinition
+ * interface which represents UNSIGNED Integer values defined in Yang language. <br>
+ * The integer built-in types in Yang are uint8,  uint16, uint32, and uint64. They
+ * represent unsigned integers of different sizes:
+ * 
+ * <ul>
+ * <li>uint8 - represents integer values between 0 and 255, inclusively.</li>
+ * <li>uint16 - represents integer values between 0 and 65535, inclusively.</li>
+ * <li>uint32 - represents integer values between 0 and 4294967295,
+      inclusively.</li>
+ * <li>uint64 - represents integer values between 0 and 18446744073709551615,
+      inclusively.</li>
+ * </ul>
+ *
+ */
+public abstract class AbstractUnsignedInteger implements
+        UnsignedIntegerTypeDefinition {
+    private final QName name;
+    private final SchemaPath path;
+    private final String description;
+    private final String reference = "https://tools.ietf.org/html/rfc6020#section-9.2";
+
+    private final String units;
+    private final List<RangeConstraint> rangeStatements;
+    
+    /**
+     * @param name
+     * @param description
+     * @param minRange
+     * @param maxRange
+     * @param units
+     */
+    public AbstractUnsignedInteger(final QName name, final String description,
+            final Number minRange, final Number maxRange, final String units) {
+        this.name = name;
+        this.description = description;
+        this.path = BaseTypes.schemaPath(name);
+        this.units = units;
+        this.rangeStatements = new ArrayList<RangeConstraint>();
+        final String rangeDescription = "Integer values between " + minRange
+                + " and " + maxRange + ", inclusively.";
+        this.rangeStatements.add(BaseConstraints.rangeConstraint(minRange,
+                maxRange, rangeDescription, "https://tools.ietf.org/html/rfc6020#section-9.2.4"));
+    }
+
+    /**
+     * @param name
+     * @param description
+     * @param rangeStatements
+     * @param units
+     */
+    public AbstractUnsignedInteger(final QName name, final String description,
+            final List<RangeConstraint> rangeStatements, final String units) {
+        this.name = name;
+        this.description = description;
+        this.path = BaseTypes.schemaPath(name);
+        this.units = units;
+        this.rangeStatements = rangeStatements;
+    }
+    
+    @Override
+    public String getUnits() {
+        return units;
+    }
+
+    @Override
+    public QName getQName() {
+        return name;
+    }
+
+    @Override
+    public SchemaPath getPath() {
+        return path;
+    }
+
+    @Override
+    public String getDescription() {
+        return description;
+    }
+
+    @Override
+    public String getReference() {
+        return reference;
+    }
+
+    @Override
+    public Status getStatus() {
+        return Status.CURRENT;
+    }
+
+    @Override
+    public List<RangeConstraint> getRangeStatements() {
+        return rangeStatements;
+    }
+
+    @Override
+    public List<UnknownSchemaNode> getUnknownSchemaNodes() {
+        return Collections.emptyList();
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result
+                + ((description == null) ? 0 : description.hashCode());
+        result = prime * result + ((name == null) ? 0 : name.hashCode());
+        result = prime * result + ((path == null) ? 0 : path.hashCode());
+        result = prime * result
+                + ((rangeStatements == null) ? 0 : rangeStatements.hashCode());
+        result = prime * result
+                + ((reference == null) ? 0 : reference.hashCode());
+        result = prime * result + ((units == null) ? 0 : units.hashCode());
+        return result;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj == null) {
+            return false;
+        }
+        if (getClass() != obj.getClass()) {
+            return false;
+        }
+        AbstractUnsignedInteger other = (AbstractUnsignedInteger) obj;
+        if (description == null) {
+            if (other.description != null) {
+                return false;
+            }
+        } else if (!description.equals(other.description)) {
+            return false;
+        }
+        if (name == null) {
+            if (other.name != null) {
+                return false;
+            }
+        } else if (!name.equals(other.name)) {
+            return false;
+        }
+        if (path == null) {
+            if (other.path != null) {
+                return false;
+            }
+        } else if (!path.equals(other.path)) {
+            return false;
+        }
+        if (rangeStatements == null) {
+            if (other.rangeStatements != null) {
+                return false;
+            }
+        } else if (!rangeStatements.equals(other.rangeStatements)) {
+            return false;
+        }
+        if (reference == null) {
+            if (other.reference != null) {
+                return false;
+            }
+        } else if (!reference.equals(other.reference)) {
+            return false;
+        }
+        if (units == null) {
+            if (other.units != null) {
+                return false;
+            }
+        } else if (!units.equals(other.units)) {
+            return false;
+        }
+        return true;
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder builder = new StringBuilder();
+        builder.append("AbstractInteger [name=");
+        builder.append(name);
+        builder.append(", path=");
+        builder.append(path);
+        builder.append(", description=");
+        builder.append(description);
+        builder.append(", reference=");
+        builder.append(reference);
+        builder.append(", units=");
+        builder.append(units);
+        builder.append(", rangeStatements=");
+        builder.append(rangeStatements);
+        builder.append("]");
+        return builder.toString();
+    }
+}
index 881a3e8640f06fc7887ee14832942250a834147a..f78f8589a1e8d520b8f072d5730b98eddca3ed80 100644 (file)
@@ -21,8 +21,8 @@ public final class BaseConstraints {
         return new LengthConstraintImpl(min, max, description, reference);\r
     }\r
 \r
-    public static RangeConstraint rangeConstraint(final long min,\r
-            final long max, final String description, final String reference) {\r
+    public static RangeConstraint rangeConstraint(final Number min,\r
+            final Number max, final String description, final String reference) {\r
         return new RangeConstraintImpl(min, max, description, reference);\r
     }\r
 \r
@@ -172,8 +172,8 @@ public final class BaseConstraints {
     }\r
 \r
     private final static class RangeConstraintImpl implements RangeConstraint {\r
-        private final Long min;\r
-        private final Long max;\r
+        private final Number min;\r
+        private final Number max;\r
 \r
         private final String description;\r
         private final String reference;\r
@@ -181,7 +181,7 @@ public final class BaseConstraints {
         private final String errorAppTag;\r
         private final String errorMessage;\r
 \r
-        public RangeConstraintImpl(Long min, Long max, String description,\r
+        public RangeConstraintImpl(Number min, Number max, String description,\r
                 String reference) {\r
             super();\r
             this.min = min;\r
@@ -215,12 +215,12 @@ public final class BaseConstraints {
         }\r
 \r
         @Override\r
-        public Long getMin() {\r
+        public Number getMin() {\r
             return min;\r
         }\r
 \r
         @Override\r
-        public Long getMax() {\r
+        public Number getMax() {\r
             return max;\r
         }\r
 \r
index e02173c5dea2921da65ce10bb77add6784011720..6a25bc815cfb51792b3833de205dced006ee2cef 100644 (file)
@@ -16,16 +16,28 @@ import org.opendaylight.controller.yang.model.api.SchemaPath;
 \r
 public final class BaseTypes {\r
 \r
-    private BaseTypes() {\r
-    }\r
+    private BaseTypes() {}\r
 \r
     public static final URI BaseTypesNamespace = URI\r
             .create("urn:ietf:params:xml:ns:yang:1");\r
 \r
+    /**\r
+     * Construct QName for Built-in base Yang type. The namespace for\r
+     * built-in base yang types is defined as: urn:ietf:params:xml:ns:yang:1\r
+     * \r
+     * @param typeName yang type name\r
+     * @return built-in base yang type QName.\r
+     */\r
     public static final QName constructQName(final String typeName) {\r
         return new QName(BaseTypesNamespace, typeName);\r
     }\r
 \r
+    /**\r
+     * Creates Schema Path from Qname.\r
+     * \r
+     * @param typeName yang type QName\r
+     * @return Schema Path from Qname.\r
+     */\r
     public static final SchemaPath schemaPath(final QName typeName) {\r
         final List<QName> pathList = new ArrayList<QName>();\r
         pathList.add(typeName);\r
index 7429c015314317d1a5a2bcbb473d949e9955c729..2ee873b33a762b8d1401102ea49cce61c589a4c4 100644 (file)
@@ -7,6 +7,7 @@
   */\r
 package org.opendaylight.controller.model.util;\r
 \r
+import java.util.ArrayList;\r
 import java.util.Collections;\r
 import java.util.List;\r
 \r
@@ -17,30 +18,54 @@ import org.opendaylight.controller.yang.model.api.SchemaPath;
 import org.opendaylight.controller.yang.model.api.Status;\r
 import org.opendaylight.controller.yang.model.api.UnknownSchemaNode;\r
 \r
+/**\r
+ * The <code>default</code> implementation of Binary Type Definition interface.\r
+ * \r
+ * @see BinaryTypeDefinition\r
+ */\r
 public class BinaryType implements BinaryTypeDefinition {\r
 \r
     private final QName name = BaseTypes.constructQName("binary");\r
     private final SchemaPath path = BaseTypes.schemaPath(name);\r
-    private final String description = "";\r
-    private final String reference = "";\r
+    private final String description = "The binary built-in type represents any binary data, i.e., a sequence of octets.";\r
+    private final String reference = "https://tools.ietf.org/html/rfc6020#section-9.8";\r
 \r
     private List<Byte> bytes;\r
     private final List<LengthConstraint> lengthConstraints;\r
     private String units = "";\r
 \r
+    /**\r
+     * \r
+     */\r
     public BinaryType() {\r
         super();\r
-\r
-        lengthConstraints = Collections.emptyList();\r
+        \r
+        final List<LengthConstraint> constraints = new ArrayList<LengthConstraint>();\r
+        constraints.add(BaseConstraints.lengthConstraint(0, Long.MAX_VALUE, "", ""));\r
+        lengthConstraints = Collections.unmodifiableList(constraints);\r
         bytes = Collections.emptyList();\r
-        bytes = Collections.unmodifiableList(bytes);\r
     }\r
 \r
+    /**\r
+     * \r
+     * \r
+     * @param bytes\r
+     * @param lengthConstraints\r
+     * @param units\r
+     */\r
     public BinaryType(final List<Byte> bytes,\r
             final List<LengthConstraint> lengthConstraints, final String units) {\r
         super();\r
-        this.bytes = bytes;\r
-        this.lengthConstraints = lengthConstraints;\r
+        \r
+        if ((lengthConstraints == null) || (lengthConstraints.isEmpty())) {\r
+            final List<LengthConstraint> constraints = new ArrayList<LengthConstraint>();\r
+            constraints.add(BaseConstraints.lengthConstraint(0, Long.MAX_VALUE, "", ""));\r
+            this.lengthConstraints = Collections.unmodifiableList(constraints);\r
+        } else {\r
+            this.lengthConstraints = Collections.unmodifiableList(lengthConstraints);\r
+        }\r
+        \r
+        this.bytes = Collections.unmodifiableList(bytes);\r
         this.units = units;\r
     }\r
 \r
index b783bc773090e76d56c197797d30f33d5fdd1c9b..ac7bcaab9653e6367f06ab41178e0b45f543ac1d 100644 (file)
@@ -16,12 +16,21 @@ import org.opendaylight.controller.yang.model.api.SchemaPath;
 import org.opendaylight.controller.yang.model.api.Status;\r
 import org.opendaylight.controller.yang.model.api.UnknownSchemaNode;\r
 \r
+\r
+/**\r
+ * The <code>default</code> implementation of Bits Type Definition interface.\r
+ * \r
+ * @see BitsTypeDefinition\r
+ */\r
 public class BitsType implements BitsTypeDefinition {\r
 \r
     private final QName name = BaseTypes.constructQName("bits");\r
     private final SchemaPath path = BaseTypes.schemaPath(name);\r
-    private final String description = "";\r
-    private final String reference = "";\r
+    private final String description = "The bits built-in type represents a bit set.  " +\r
+               "That is, a bits value is a set of flags identified by small integer position " +\r
+               "numbers starting at 0.  Each bit number has an assigned name.";\r
+    \r
+    private final String reference = "https://tools.ietf.org/html/rfc6020#section-9.7";\r
 \r
     private final List<Bit> bits;\r
     private String units = "";\r
@@ -29,7 +38,6 @@ public class BitsType implements BitsTypeDefinition {
     /**\r
      * Default constructor. <br>\r
      * Instantiates Bits type as empty bits list.\r
-     * \r
      */\r
     public BitsType() {\r
         super();\r
@@ -37,7 +45,7 @@ public class BitsType implements BitsTypeDefinition {
     }\r
 \r
     /**\r
-     * Overloaded constructor with explicit definition of bits assigned to\r
+     * Constructor with explicit definition of bits assigned to\r
      * BitsType.\r
      * \r
      * @param bits\r
@@ -49,10 +57,18 @@ public class BitsType implements BitsTypeDefinition {
         this.units = "";\r
     }\r
 \r
+    /**\r
+     * Constructor with explicit definition of bits assigned to\r
+     * BitsType and Units.\r
+     * <br>\r
+     * The default value of Bits Type is List of bits.\r
+     * \r
+     * @param bits The bits assigned for Bits Type\r
+     * @param units units for bits type\r
+     */\r
     public BitsType(List<Bit> bits, String units) {\r
         super();\r
         this.bits = Collections.unmodifiableList(bits);\r
-        ;\r
         this.units = units;\r
     }\r
 \r
index c9d319d2c6559eb8467d1c36627eecb4cff31aaa..171612b1cdeee0d7e3f4afab121e46bc1507668b 100644 (file)
@@ -16,12 +16,17 @@ import org.opendaylight.controller.yang.model.api.SchemaPath;
 import org.opendaylight.controller.yang.model.api.Status;\r
 import org.opendaylight.controller.yang.model.api.UnknownSchemaNode;\r
 \r
+/**\r
+ * The <code>default</code> implementation of Boolean Type Definition interface.\r
+ * \r
+ * @see BooleanTypeDefinition\r
+ */\r
 public class BooleanType implements BooleanTypeDefinition {\r
 \r
     private final QName name = BaseTypes.constructQName("boolean");\r
     private final SchemaPath path = BaseTypes.schemaPath(name);\r
-    private final String description = "";\r
-    private final String reference = "";\r
+    private final String description = "The boolean built-in type represents a boolean value.";\r
+    private final String reference = "https://tools.ietf.org/html/rfc6020#section-9.5";\r
 \r
     private final Boolean defaultValue;\r
     private String units = "";\r
@@ -35,9 +40,9 @@ public class BooleanType implements BooleanTypeDefinition {
     }\r
 \r
     /**\r
+     * Boolean Type constructor.\r
      * \r
-     * \r
-     * @param defaultValue\r
+     * @param defaultValue Default Value\r
      */\r
     public BooleanType(final Boolean defaultValue) {\r
         super();\r
@@ -45,10 +50,10 @@ public class BooleanType implements BooleanTypeDefinition {
     }\r
 \r
     /**\r
+     * Boolean Type constructor.\r
      * \r
-     * \r
-     * @param defaultValue\r
-     * @param units\r
+     * @param defaultValue Default Value\r
+     * @param units Units\r
      */\r
     public BooleanType(final Boolean defaultValue, final String units) {\r
         super();\r
index 233e4607ce703eeb1cadd7f6499154e1c293a41a..31c8c0d32da5764b4ad0b07878cccf6410825ac3 100644 (file)
@@ -1,10 +1,10 @@
 /*\r
 * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.\r
 *\r
 * This program and the accompanying materials are made available under the\r
 * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
 * and is available at http://www.eclipse.org/legal/epl-v10.html\r
 */\r
+ * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.\r
+ *\r
+ * This program and the accompanying materials are made available under the\r
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
+ * and is available at http://www.eclipse.org/legal/epl-v10.html\r
+ */\r
 package org.opendaylight.controller.model.util;\r
 \r
 import java.math.BigDecimal;\r
@@ -19,6 +19,12 @@ import org.opendaylight.controller.yang.model.api.SchemaPath;
 import org.opendaylight.controller.yang.model.api.Status;\r
 import org.opendaylight.controller.yang.model.api.UnknownSchemaNode;\r
 \r
+/**\r
+ * The <code>default</code> implementation of Decimal Type Definition interface.\r
+ * \r
+ * \r
+ * @see DecimalTypeDefinition\r
+ */\r
 public class Decimal64 implements DecimalTypeDefinition {\r
 \r
     private final QName name = BaseTypes.constructQName("decimal64");\r
@@ -27,7 +33,7 @@ public class Decimal64 implements DecimalTypeDefinition {
     private BigDecimal defaultValue = null;\r
 \r
     private final String description = "The decimal64 type represents a subset of the real numbers, which can "\r
-            + "be represented by decimal numerals.  The value space of decimal64 is the set of numbers that can "\r
+            + "be represented by decimal numerals. The value space of decimal64 is the set of numbers that can "\r
             + "be obtained by multiplying a 64-bit signed integer by a negative power of ten, i.e., expressible as "\r
             + "'i x 10^-n' where i is an integer64 and n is an integer between 1 and 18, inclusively.";\r
 \r
@@ -36,32 +42,132 @@ public class Decimal64 implements DecimalTypeDefinition {
     private final List<RangeConstraint> rangeStatements;\r
     private final Integer fractionDigits;\r
 \r
+    /**\r
+     * Default Decimal64 Type Constructor. <br>\r
+     * <br>\r
+     * The initial range statements are set to Decimal64\r
+     * <code>min=-922337203685477580.8</code> and\r
+     * <code>max=922337203685477580.7</code> <br>\r
+     * The fractions digits MUST be defined as integer between 1 and 18\r
+     * inclusively as defined interface {@link DecimalTypeDefinition} <br>\r
+     * If the fraction digits are not defined inner the definition boundaries\r
+     * the constructor will throw {@link IllegalArgumentException}\r
+     * \r
+     * @param fractionDigits\r
+     *            integer between 1 and 18 inclusively\r
+     * \r
+     * @see DecimalTypeDefinition\r
+     * @exception IllegalArgumentException\r
+     */\r
     public Decimal64(final Integer fractionDigits) {\r
         super();\r
+        if (!((fractionDigits.intValue() > 1) && (fractionDigits.intValue() <= 18))) {\r
+            throw new IllegalArgumentException(\r
+                    "The fraction digits outside of boundaries. Fraction digits MUST be integer between 1 and 18 inclusively");\r
+        }\r
         this.fractionDigits = fractionDigits;\r
-        rangeStatements = new ArrayList<RangeConstraint>();\r
+        rangeStatements = defaultRangeStatements();\r
         this.path = BaseTypes.schemaPath(name);\r
     }\r
 \r
+    /**\r
+     * Decimal64 Type Constructor. <br>\r
+     * \r
+     * If parameter <code>Range Statements</code> is <code>null</code> or\r
+     * defined as <code>empty List</code> the constructor automatically assigns\r
+     * the boundaries as min and max value defined for Decimal64 in <a\r
+     * href="https://tools.ietf.org/html/rfc6020#section-9.3">[RFC-6020] The\r
+     * decimal64 Built-In Type</a> <br>\r
+     * <br>\r
+     * The fractions digits MUST be defined as integer between 1 and 18\r
+     * inclusively as defined interface {@link DecimalTypeDefinition} <br>\r
+     * If the fraction digits are not defined inner the definition boundaries\r
+     * the constructor will throw {@link IllegalArgumentException}\r
+     * \r
+     * @param rangeStatements\r
+     *            Range Constraint Statements\r
+     * @param fractionDigits\r
+     *            integer between 1 and 18 inclusively\r
+     * @exception IllegalArgumentException\r
+     */\r
     public Decimal64(final List<RangeConstraint> rangeStatements,\r
             Integer fractionDigits) {\r
         super();\r
-        this.rangeStatements = rangeStatements;\r
+        if (!((fractionDigits.intValue() > 1) && (fractionDigits.intValue() <= 18))) {\r
+            throw new IllegalArgumentException(\r
+                    "The fraction digits outside of boundaries. Fraction digits MUST be integer between 1 and 18 inclusively");\r
+        }\r
+        if (rangeStatements == null || rangeStatements.isEmpty()) {\r
+            this.rangeStatements = defaultRangeStatements();\r
+        } else {\r
+            this.rangeStatements = Collections.unmodifiableList(rangeStatements);\r
+        }\r
         this.fractionDigits = fractionDigits;\r
         this.path = BaseTypes.schemaPath(name);\r
     }\r
 \r
+    /**\r
+     * Decimal64 Type Constructor. <br>\r
+     * If parameter <code>Range Statements</code> is <code>null</code> or\r
+     * defined as <code>empty List</code> the constructor automatically assigns\r
+     * the boundaries as min and max value defined for Decimal64 in <a\r
+     * href="https://tools.ietf.org/html/rfc6020#section-9.3">[RFC-6020] The\r
+     * decimal64 Built-In Type</a> <br>\r
+     * <br>\r
+     * The fractions digits MUST be defined as integer between 1 and 18\r
+     * inclusively as defined interface {@link DecimalTypeDefinition} <br>\r
+     * If the fraction digits are not defined inner the definition boundaries\r
+     * the constructor will throw {@link IllegalArgumentException}\r
+     * \r
+     * @param units\r
+     *            units associated with the type\r
+     * @param defaultValue\r
+     *            Default Value for type\r
+     * @param rangeStatements\r
+     *            Range Constraint Statements\r
+     * @param fractionDigits\r
+     *            integer between 1 and 18 inclusively\r
+     * \r
+     * @exception IllegalArgumentException\r
+     */\r
     public Decimal64(final String units, final BigDecimal defaultValue,\r
             final List<RangeConstraint> rangeStatements,\r
             final Integer fractionDigits) {\r
         super();\r
+        if (!((fractionDigits.intValue() > 1) && (fractionDigits.intValue() <= 18))) {\r
+            throw new IllegalArgumentException(\r
+                    "The fraction digits outside of boundaries. Fraction digits MUST be integer between 1 and 18 inclusively");\r
+        }\r
+\r
+        if (rangeStatements == null || rangeStatements.isEmpty()) {\r
+            this.rangeStatements = defaultRangeStatements();\r
+            \r
+        } else {\r
+            this.rangeStatements = Collections.unmodifiableList(rangeStatements);\r
+        }\r
         this.units = units;\r
         this.defaultValue = defaultValue;\r
-        this.rangeStatements = rangeStatements;\r
         this.fractionDigits = fractionDigits;\r
         this.path = BaseTypes.schemaPath(name);\r
     }\r
 \r
+    /**\r
+     * Returns unmodifiable List with default definition of Range Statements.\r
+     * \r
+     * @return unmodifiable List with default definition of Range Statements.\r
+     */\r
+    private List<RangeConstraint> defaultRangeStatements() {\r
+        final List<RangeConstraint> rangeStatements = new ArrayList<RangeConstraint>();\r
+        final BigDecimal min = new BigDecimal("-922337203685477580.8");\r
+        final BigDecimal max = new BigDecimal("922337203685477580.7");\r
+        final String rangeDescription = "Integer values between " + min\r
+                + " and " + max + ", inclusively.";\r
+        rangeStatements.add(BaseConstraints.rangeConstraint(min, max,\r
+                rangeDescription,\r
+                "https://tools.ietf.org/html/rfc6020#section-9.2.4"));\r
+        return Collections.unmodifiableList(rangeStatements);\r
+    }\r
+\r
     @Override\r
     public DecimalTypeDefinition getBaseType() {\r
         return this;\r
@@ -117,6 +223,44 @@ public class Decimal64 implements DecimalTypeDefinition {
         return fractionDigits;\r
     }\r
 \r
+    @Override\r
+    public int hashCode() {\r
+        final int prime = 31;\r
+        int result = 1;\r
+        result = prime * result + ((name == null) ? 0 : name.hashCode());\r
+        result = prime * result + ((path == null) ? 0 : path.hashCode());\r
+        return result;\r
+    }\r
+\r
+    @Override\r
+    public boolean equals(Object obj) {\r
+        if (this == obj) {\r
+            return true;\r
+        }\r
+        if (obj == null) {\r
+            return false;\r
+        }\r
+        if (getClass() != obj.getClass()) {\r
+            return false;\r
+        }\r
+        Decimal64 other = (Decimal64) obj;\r
+        if (name == null) {\r
+            if (other.name != null) {\r
+                return false;\r
+            }\r
+        } else if (!name.equals(other.name)) {\r
+            return false;\r
+        }\r
+        if (path == null) {\r
+            if (other.path != null) {\r
+                return false;\r
+            }\r
+        } else if (!path.equals(other.path)) {\r
+            return false;\r
+        }\r
+        return true;\r
+    }\r
+\r
     @Override\r
     public String toString() {\r
         return Decimal64.class.getSimpleName() + "[qname=" + name\r
index 34ac5374f7415f6e965b40571b59ecd57c86d33d..66a7d30c31f13248c3fa1a42f0e3983ae1c1126d 100644 (file)
@@ -16,6 +16,11 @@ import org.opendaylight.controller.yang.model.api.SchemaPath;
 import org.opendaylight.controller.yang.model.api.Status;\r
 import org.opendaylight.controller.yang.model.api.UnknownSchemaNode;\r
 \r
+/**\r
+ * The <code>default</code> implementation of Enumertaion Type Definition interface.\r
+ * \r
+ * @see EnumTypeDefinition\r
+ */\r
 public class EnumerationType implements EnumTypeDefinition {\r
 \r
     private final QName name = BaseTypes.constructQName("enumeration");\r
@@ -29,16 +34,15 @@ public class EnumerationType implements EnumTypeDefinition {
 \r
     public EnumerationType(final List<EnumPair> enums) {\r
         super();\r
-        this.enums = enums;\r
-\r
+        this.enums = Collections.unmodifiableList(enums);\r
         defaultEnum = Collections.emptyList();\r
     }\r
 \r
     public EnumerationType(final List<EnumPair> defaultEnum,\r
             final List<EnumPair> enums, final String units) {\r
         super();\r
-        this.defaultEnum = defaultEnum;\r
-        this.enums = enums;\r
+        this.defaultEnum = Collections.unmodifiableList(defaultEnum);\r
+        this.enums = Collections.unmodifiableList(enums);\r
         this.units = units;\r
     }\r
 \r
index 775d368eaf27ae543dbaedccfa3cb000c5d9ccb3..750b11217c0f2aa55dadea3a0592677c6fa00722 100644 (file)
@@ -16,12 +16,18 @@ import org.opendaylight.controller.yang.model.api.SchemaPath;
 import org.opendaylight.controller.yang.model.api.Status;\r
 import org.opendaylight.controller.yang.model.api.UnknownSchemaNode;\r
 \r
+/**\r
+ * The <code>default</code> implementation of Identity Type Definition interface.\r
+ * \r
+ * @see IdentityTypeDefinition\r
+ */\r
 public class IdentityType implements IdentityTypeDefinition {\r
 \r
     private final QName name = BaseTypes.constructQName("identity");\r
     private final SchemaPath path = BaseTypes.schemaPath(name);\r
-    private final String description = "";\r
-    private final String reference = "";\r
+    private final String description = "The 'identity' statement is used to define a new " +\r
+               "globally unique, abstract, and untyped identity.";\r
+    private final String reference = "https://tools.ietf.org/html/rfc6020#section-7.16";\r
 \r
     private String units = "";\r
     private final QName identityName;\r
index 24ab0af1ad0806c82497f32d13e6a7661d860131..24c3163cc0664654b305527cd5a0824949aacb0a 100644 (file)
@@ -18,12 +18,17 @@ import org.opendaylight.controller.yang.model.api.SchemaPath;
 import org.opendaylight.controller.yang.model.api.Status;\r
 import org.opendaylight.controller.yang.model.api.UnknownSchemaNode;\r
 \r
+/**\r
+ * The <code>default</code> implementation of Identityref Type Definition interface.\r
+ *\r
+ * @see IdentityrefTypeDefinition\r
+ */\r
 public class Identityref implements IdentityrefTypeDefinition {\r
 \r
     private final QName name = BaseTypes.constructQName("identityref");\r
     private final SchemaPath path = BaseTypes.schemaPath(name);\r
-    private final String description = "";\r
-    private final String reference = "";\r
+    private final String description = "The identityref type is used to reference an existing identity.";\r
+    private final String reference = "https://tools.ietf.org/html/rfc6020#section-9.10";\r
 \r
     private final IdentityTypeDefinition identity;\r
     private final RevisionAwareXPath xpath;\r
index 9a238aea1f031935a6c69c1155852f12bf5d003b..4dd3e2164d6a584d87e1b7ef4ae802a6f193c239 100644 (file)
@@ -17,12 +17,18 @@ import org.opendaylight.controller.yang.model.api.SchemaPath;
 import org.opendaylight.controller.yang.model.api.Status;\r
 import org.opendaylight.controller.yang.model.api.UnknownSchemaNode;\r
 \r
+/**\r
+ * The <code>default</code> implementation of Instance Identifier Type Definition interface.\r
+ *\r
+ * @see InstanceIdentifierTypeDefinition\r
+ */\r
 public class InstanceIdentifier implements InstanceIdentifierTypeDefinition {\r
 \r
     private static final QName name = BaseTypes\r
             .constructQName("instance-identifier");\r
-    private static final String description = "";\r
-    private static final String reference = "";\r
+    private static final String description = "The instance-identifier built-in type is used to " +\r
+               "uniquely identify a particular instance node in the data tree.";\r
+    private static final String reference = "https://tools.ietf.org/html/rfc6020#section-9.13";\r
 \r
     private final transient SchemaPath path = BaseTypes.schemaPath(name);\r
     private final RevisionAwareXPath xpath;\r
index 49ac4d1649bbaebbb756bd3350c2baeeda151435..9d2376972042a8dc739a663620a0912db9762029 100644 (file)
@@ -1,10 +1,10 @@
 /*\r
 * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.\r
 *\r
 * This program and the accompanying materials are made available under the\r
 * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
 * and is available at http://www.eclipse.org/legal/epl-v10.html\r
 */\r
+ * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.\r
+ *\r
+ * This program and the accompanying materials are made available under the\r
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
+ * and is available at http://www.eclipse.org/legal/epl-v10.html\r
+ */\r
 package org.opendaylight.controller.model.util;\r
 \r
 import java.util.List;\r
@@ -13,36 +13,27 @@ import org.opendaylight.controller.model.api.type.IntegerTypeDefinition;
 import org.opendaylight.controller.model.api.type.RangeConstraint;\r
 import org.opendaylight.controller.yang.common.QName;\r
 \r
-public class Int16 extends AbstractInteger {\r
+/**\r
+ * Implementation of Yang int16 built-in type. <br>\r
+ * int16 represents integer values between -32768 and 32767, inclusively. The\r
+ * Java counterpart of Yang int16 built-in type is {@link Short}.\r
+ * \r
+ * @see AbstractSignedInteger\r
+ */\r
+public class Int16 extends AbstractSignedInteger {\r
 \r
     private static final QName name = BaseTypes.constructQName("int16");\r
     private Short defaultValue = null;\r
-    private static final String description = "";\r
-    private static final String reference = "";\r
+    private static final String description = \r
+            "int16  represents integer values between -32768 and 32767, inclusively.";\r
 \r
     public Int16() {\r
-        super(name, description, reference);\r
-    }\r
-\r
-    public Int16(final Short defaultValue) {\r
-        super(name, description, reference);\r
-        this.defaultValue = defaultValue;\r
-    }\r
-\r
-    public Int16(final List<RangeConstraint> rangeStatements,\r
-            final Short defaultValue) {\r
-        super(name, description, reference, rangeStatements);\r
-        this.defaultValue = defaultValue;\r
-    }\r
-\r
-    public Int16(final String units, final Short defaultValue) {\r
-        super(name, description, reference, units);\r
-        this.defaultValue = defaultValue;\r
+        super(name, description, Short.MIN_VALUE, Short.MAX_VALUE, "");\r
     }\r
 \r
     public Int16(final List<RangeConstraint> rangeStatements,\r
             final String units, final Short defaultValue) {\r
-        super(name, description, reference, units, rangeStatements);\r
+        super(name, description, rangeStatements, units);\r
         this.defaultValue = defaultValue;\r
     }\r
 \r
index 18908750c4d38031d3580b6698b9afedbeaf1df6..ee8b929942c6aba9a4286bf2a4ae937083549f0b 100644 (file)
@@ -1,10 +1,10 @@
 /*\r
 * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.\r
 *\r
 * This program and the accompanying materials are made available under the\r
 * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
 * and is available at http://www.eclipse.org/legal/epl-v10.html\r
 */\r
+ * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.\r
+ *\r
+ * This program and the accompanying materials are made available under the\r
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
+ * and is available at http://www.eclipse.org/legal/epl-v10.html\r
+ */\r
 package org.opendaylight.controller.model.util;\r
 \r
 import java.util.List;\r
@@ -13,43 +13,42 @@ import org.opendaylight.controller.model.api.type.IntegerTypeDefinition;
 import org.opendaylight.controller.model.api.type.RangeConstraint;\r
 import org.opendaylight.controller.yang.common.QName;\r
 \r
-public class Int32 extends AbstractInteger {\r
+/**\r
+ * Implementation of Yang int32 built-in type. <br>\r
+ * int32 represents integer values between -2147483648 and 2147483647,\r
+ * inclusively. The Java counterpart of Yang int32 built-in type is\r
+ * {@link Integer}.\r
+ * \r
+ * @see AbstractSignedInteger\r
+ * \r
+ */\r
+public class Int32 extends AbstractSignedInteger {\r
 \r
     private static final QName name = BaseTypes.constructQName("int32");\r
     private Integer defaultValue = null;\r
-    private static final String description = "";\r
-    private static final String reference = "";\r
+    private static final String description = \r
+            "int32  represents integer values between -2147483648 and 2147483647, inclusively.";\r
 \r
     public Int32() {\r
-        super(name, description, reference);\r
+        super(name, description, Integer.MIN_VALUE, Integer.MAX_VALUE, "");\r
     }\r
 \r
     public Int32(final Integer defaultValue) {\r
-        super(name, description, reference);\r
-        this.defaultValue = defaultValue;\r
-    }\r
-\r
-    public Int32(final List<RangeConstraint> rangeStatements,\r
-            final Integer defaultValue) {\r
-        super(name, description, reference, rangeStatements);\r
-        this.defaultValue = defaultValue;\r
-    }\r
-\r
-    public Int32(final String units, final Integer defaultValue) {\r
-        super(name, description, reference, units);\r
+        super(name, description, Integer.MIN_VALUE, Integer.MAX_VALUE, "");\r
         this.defaultValue = defaultValue;\r
     }\r
 \r
     public Int32(final List<RangeConstraint> rangeStatements,\r
             final String units, final Integer defaultValue) {\r
-        super(name, description, reference, units, rangeStatements);\r
+        super(name, description, rangeStatements, units);\r
         this.defaultValue = defaultValue;\r
     }\r
 \r
     /*\r
      * (non-Javadoc)\r
      * \r
-     * @see org.opendaylight.controller.yang.model.api.TypeDefinition#getBaseType()\r
+     * @see\r
+     * org.opendaylight.controller.yang.model.api.TypeDefinition#getBaseType()\r
      */\r
     @Override\r
     public IntegerTypeDefinition getBaseType() {\r
@@ -59,7 +58,9 @@ public class Int32 extends AbstractInteger {
     /*\r
      * (non-Javadoc)\r
      * \r
-     * @see org.opendaylight.controller.yang.model.api.TypeDefinition#getDefaultValue()\r
+     * @see\r
+     * org.opendaylight.controller.yang.model.api.TypeDefinition#getDefaultValue\r
+     * ()\r
      */\r
     @Override\r
     public Object getDefaultValue() {\r
index c03c6b7bf6f61b1b251f39aa5a593aaa5222b94b..25d2b6d056ede70f2b3105e6a823dd9fed104bba 100644 (file)
@@ -13,36 +13,32 @@ import org.opendaylight.controller.model.api.type.IntegerTypeDefinition;
 import org.opendaylight.controller.model.api.type.RangeConstraint;\r
 import org.opendaylight.controller.yang.common.QName;\r
 \r
-public class Int64 extends AbstractInteger {\r
+/**\r
+ * Implementation of Yang int64 built-in type. <br>\r
+ * int64  represents integer values between -9223372036854775808 and 9223372036854775807, inclusively. \r
+ * The Java counterpart of Yang int64 built-in type is\r
+ * {@link Long}.\r
+ *\r
+ */\r
+public class Int64 extends AbstractSignedInteger {\r
 \r
     private static final QName name = BaseTypes.constructQName("int64");\r
     private Long defaultValue = null;\r
-    private static final String description = "";\r
-    private static final String reference = "";\r
+    private static final String description = \r
+            "int64  represents integer values between -9223372036854775808 and 9223372036854775807, inclusively.";\r
 \r
     public Int64() {\r
-        super(name, description, reference);\r
+        super(name, description, Integer.MIN_VALUE, Integer.MAX_VALUE, "");\r
     }\r
 \r
     public Int64(final Long defaultValue) {\r
-        super(name, description, reference);\r
-        this.defaultValue = defaultValue;\r
-    }\r
-\r
-    public Int64(final List<RangeConstraint> rangeStatements,\r
-            final Long defaultValue) {\r
-        super(name, description, reference, rangeStatements);\r
-        this.defaultValue = defaultValue;\r
-    }\r
-\r
-    public Int64(final String units, final Long defaultValue) {\r
-        super(name, description, reference, units);\r
+        super(name, description, Integer.MIN_VALUE, Integer.MAX_VALUE, "");\r
         this.defaultValue = defaultValue;\r
     }\r
 \r
     public Int64(final List<RangeConstraint> rangeStatements,\r
             final String units, final Long defaultValue) {\r
-        super(name, description, reference, units, rangeStatements);\r
+        super(name, description, rangeStatements, units);\r
         this.defaultValue = defaultValue;\r
     }\r
 \r
index ebb5fa7c6a984f75bb36cb8381cb60d4c27ed202..53b9c19573320d83323394337a2f6937812db43b 100644 (file)
@@ -13,36 +13,33 @@ import org.opendaylight.controller.model.api.type.IntegerTypeDefinition;
 import org.opendaylight.controller.model.api.type.RangeConstraint;\r
 import org.opendaylight.controller.yang.common.QName;\r
 \r
-public class Int8 extends AbstractInteger {\r
+/**\r
+ * Implementation of Yang int8 built-in type.\r
+ * <br>\r
+ * int8 represents integer values between -128 and 127, inclusively. The Java counterpart of \r
+ * Yang int8 built-in type is {@link Byte}.\r
+ * \r
+ * @see AbstractSignedInteger\r
+ */\r
+public class Int8 extends AbstractSignedInteger {\r
 \r
     private static final QName name = BaseTypes.constructQName("int8");\r
     private Byte defaultValue = null;\r
-    private static final String description = "";\r
-    private static final String reference = "";\r
-\r
+    private static final String description = \r
+            "represents integer values between -128 and 127, inclusively.";\r
+    \r
     public Int8() {\r
-        super(name, description, reference);\r
+        super(name, description, Byte.MIN_VALUE, Byte.MAX_VALUE, "");\r
     }\r
 \r
     public Int8(final Byte defaultValue) {\r
-        super(name, description, reference);\r
-        this.defaultValue = defaultValue;\r
-    }\r
-\r
-    public Int8(final List<RangeConstraint> rangeStatements,\r
-            final Byte defaultValue) {\r
-        super(name, description, reference, rangeStatements);\r
-        this.defaultValue = defaultValue;\r
-    }\r
-\r
-    public Int8(final String units, final Byte defaultValue) {\r
-        super(name, description, reference, units);\r
+        super(name, description, Byte.MIN_VALUE, Byte.MAX_VALUE, "");\r
         this.defaultValue = defaultValue;\r
     }\r
 \r
     public Int8(final List<RangeConstraint> rangeStatements,\r
             final String units, final Byte defaultValue) {\r
-        super(name, description, reference, units, rangeStatements);\r
+        super(name, description, rangeStatements, units);\r
         this.defaultValue = defaultValue;\r
     }\r
 \r
index 9c99d4218a77c0f06a0a9246e66d4cf2fd7b5d26..a185d55ea6be6b0ead0554d30268f92e3c97a5e6 100644 (file)
@@ -17,10 +17,16 @@ import org.opendaylight.controller.yang.model.api.SchemaPath;
 import org.opendaylight.controller.yang.model.api.Status;\r
 import org.opendaylight.controller.yang.model.api.UnknownSchemaNode;\r
 \r
+/**\r
+ * The <code>default</code> implementation of Instance Leafref Type Definition interface.\r
+ *\r
+ * @see LeafrefTypeDefinition\r
+ */\r
 public class Leafref implements LeafrefTypeDefinition {\r
     private static final QName name = BaseTypes.constructQName("leafref");\r
-    private static final String description = "";\r
-    private static final String reference = "";\r
+    private static final String description = "The leafref type is used to reference a " +\r
+               "particular leaf instance in the data tree.";\r
+    private static final String reference = "https://tools.ietf.org/html/rfc6020#section-9.9";\r
     private final SchemaPath path = BaseTypes.schemaPath(name);\r
     private final RevisionAwareXPath xpath;\r
     private final String units = "";\r
index d3328f38046757c683609a3170b61e043bcc0c47..ef4ea8463db4c8c30967e4c2b1350093a1a920cc 100644 (file)
@@ -9,6 +9,11 @@ package org.opendaylight.controller.model.util;
 
 import org.opendaylight.controller.yang.model.api.RevisionAwareXPath;
 
+/**
+ * The <code>default</code> implementation of Instance Rewision Aware XPath interface.
+ * 
+ * @see RevisionAwareXPath
+ */
 public class RevisionAwareXPathImpl implements RevisionAwareXPath {
 
     private final String xpath;
@@ -24,11 +29,6 @@ public class RevisionAwareXPathImpl implements RevisionAwareXPath {
         return absolute;
     }
 
-    @Override
-    public String toString() {
-        return xpath;
-    }
-
     @Override
     public int hashCode() {
         final int prime = 31;
@@ -62,5 +62,9 @@ public class RevisionAwareXPathImpl implements RevisionAwareXPath {
         }
         return false;
     }
-
+    
+    @Override
+    public String toString() {
+        return xpath;
+    }
 }
index 99b6d26684af44bad5949e60acca58a1cd0aa190..e0acee2dd4d18d0e83e2c0696384407c52ff95b0 100644 (file)
@@ -7,6 +7,7 @@
   */\r
 package org.opendaylight.controller.model.util;\r
 \r
+import java.util.ArrayList;\r
 import java.util.Collections;\r
 import java.util.List;\r
 \r
@@ -18,6 +19,11 @@ import org.opendaylight.controller.yang.model.api.SchemaPath;
 import org.opendaylight.controller.yang.model.api.Status;\r
 import org.opendaylight.controller.yang.model.api.UnknownSchemaNode;\r
 \r
+/**\r
+ * The <code>default</code> implementation of String Type Definition interface.\r
+ *\r
+ * @see StringTypeDefinition\r
+ */\r
 public class StringType implements StringTypeDefinition {\r
 \r
     private final QName name = BaseTypes.constructQName("string");;\r
@@ -29,21 +35,41 @@ public class StringType implements StringTypeDefinition {
     private final List<PatternConstraint> patterns;\r
     private String units = "";\r
 \r
+    /**\r
+     * Default Constructor.\r
+     */\r
     public StringType() {\r
         super();\r
         path = BaseTypes.schemaPath(name);\r
-        this.lengthStatements = Collections.emptyList();\r
+        final List<LengthConstraint> constraints = new ArrayList<LengthConstraint>();\r
+        constraints.add(BaseConstraints.lengthConstraint(0, Long.MAX_VALUE, "", ""));\r
+        lengthStatements = Collections.unmodifiableList(constraints);\r
+        \r
         this.patterns = Collections.emptyList();\r
     }\r
 \r
-    public StringType(List<LengthConstraint> lengthStatements,\r
-            List<PatternConstraint> patterns) {\r
+    /**\r
+     * \r
+     * \r
+     * @param lengthStatements\r
+     * @param patterns\r
+     */\r
+    public StringType(final List<LengthConstraint> lengthStatements,\r
+            final List<PatternConstraint> patterns) {\r
         super();\r
         path = BaseTypes.schemaPath(name);\r
         this.lengthStatements = Collections.unmodifiableList(lengthStatements);\r
         this.patterns = Collections.unmodifiableList(patterns);\r
     }\r
 \r
+    /**\r
+     * \r
+     * \r
+     * @param defaultValue\r
+     * @param lengthStatements\r
+     * @param patterns\r
+     * @param units\r
+     */\r
     public StringType(final String defaultValue,\r
             final List<LengthConstraint> lengthStatements,\r
             final List<PatternConstraint> patterns, final String units) {\r
index 5094d77bd518340961fd81e254650cfa17ac1022..a5540bf0c77b8443b2dedb58e9bdba2d9785f0cb 100644 (file)
@@ -1,59 +1,62 @@
 /*\r
 * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.\r
 *\r
 * This program and the accompanying materials are made available under the\r
 * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
 * and is available at http://www.eclipse.org/legal/epl-v10.html\r
 */\r
+ * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.\r
+ *\r
+ * This program and the accompanying materials are made available under the\r
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
+ * and is available at http://www.eclipse.org/legal/epl-v10.html\r
+ */\r
 package org.opendaylight.controller.model.util;\r
 \r
 import java.util.List;\r
 \r
-import org.opendaylight.controller.model.api.type.IntegerTypeDefinition;\r
 import org.opendaylight.controller.model.api.type.RangeConstraint;\r
+import org.opendaylight.controller.model.api.type.UnsignedIntegerTypeDefinition;\r
 import org.opendaylight.controller.yang.common.QName;\r
 \r
-public class Uint16 extends AbstractInteger {\r
+/**\r
+ * Implementation of Yang uint32 built-in type. <br>\r
+ * uint16 represents integer values between 0 and 65535, inclusively. The Java\r
+ * counterpart of Yang uint32 built-in type is {@link Integer}.\r
+ * \r
+ */\r
+public class Uint16 extends AbstractUnsignedInteger {\r
 \r
     private static final QName name = BaseTypes.constructQName("uint16");\r
     private Integer defaultValue = null;\r
-    private static final String description = "";\r
-    private static final String reference = "";\r
+    private static final String description = "uint16 represents integer values between 0 and 65535, inclusively.";\r
 \r
     public Uint16() {\r
-        super(name, description, reference);\r
+        super(name, description, Short.MIN_VALUE, Short.MAX_VALUE, "");\r
     }\r
 \r
     public Uint16(final Integer defaultValue) {\r
-        super(name, description, reference);\r
+        super(name, description, Short.MIN_VALUE, Short.MAX_VALUE, "");\r
         this.defaultValue = defaultValue;\r
     }\r
 \r
     public Uint16(final List<RangeConstraint> rangeStatements,\r
-            final Integer defaultValue) {\r
-        super(name, description, reference, rangeStatements);\r
-        this.defaultValue = defaultValue;\r
-    }\r
-\r
-    public Uint16(final String units, final Integer defaultValue) {\r
-        super(name, description, reference, units);\r
+            final String units, final Integer defaultValue) {\r
+        super(name, description, rangeStatements, units);\r
         this.defaultValue = defaultValue;\r
     }\r
 \r
     /*\r
      * (non-Javadoc)\r
      * \r
-     * @see org.opendaylight.controller.yang.model.api.TypeDefinition#getBaseType()\r
+     * @see\r
+     * org.opendaylight.controller.yang.model.api.TypeDefinition#getBaseType()\r
      */\r
     @Override\r
-    public IntegerTypeDefinition getBaseType() {\r
+    public UnsignedIntegerTypeDefinition getBaseType() {\r
         return this;\r
     }\r
 \r
     /*\r
      * (non-Javadoc)\r
      * \r
-     * @see org.opendaylight.controller.yang.model.api.TypeDefinition#getDefaultValue()\r
+     * @see\r
+     * org.opendaylight.controller.yang.model.api.TypeDefinition#getDefaultValue\r
+     * ()\r
      */\r
     @Override\r
     public Object getDefaultValue() {\r
index 48c6a47ecb92c6acfda9fde89dfa672e7c28f085..083cd7e32e8e5be077c9c8694b2c7e6d344b422a 100644 (file)
@@ -1,59 +1,62 @@
 /*\r
 * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.\r
 *\r
 * This program and the accompanying materials are made available under the\r
 * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
 * and is available at http://www.eclipse.org/legal/epl-v10.html\r
 */\r
+ * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.\r
+ *\r
+ * This program and the accompanying materials are made available under the\r
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
+ * and is available at http://www.eclipse.org/legal/epl-v10.html\r
+ */\r
 package org.opendaylight.controller.model.util;\r
 \r
 import java.util.List;\r
 \r
-import org.opendaylight.controller.model.api.type.IntegerTypeDefinition;\r
 import org.opendaylight.controller.model.api.type.RangeConstraint;\r
+import org.opendaylight.controller.model.api.type.UnsignedIntegerTypeDefinition;\r
 import org.opendaylight.controller.yang.common.QName;\r
 \r
-public class Uint32 extends AbstractInteger {\r
+/**\r
+ * Implementation of Yang uint32 built-in type. <br>\r
+ * uint32 represents integer values between 0 and 4294967295, inclusively. The\r
+ * Java counterpart of Yang uint32 built-in type is {@link Long}.\r
+ * \r
+ */\r
+public class Uint32 extends AbstractUnsignedInteger {\r
 \r
     private static final QName name = BaseTypes.constructQName("uint32");\r
     private Long defaultValue = null;\r
-    private static final String description = "";\r
-    private static final String reference = "";\r
+    private static final String description = "uint32 represents integer values between 0 and 4294967295, inclusively.";\r
 \r
     public Uint32() {\r
-        super(name, description, reference);\r
+        super(name, description, Short.MIN_VALUE, Short.MAX_VALUE, "");\r
     }\r
 \r
     public Uint32(final Long defaultValue) {\r
-        super(name, description, reference);\r
+        super(name, description, Short.MIN_VALUE, Short.MAX_VALUE, "");\r
         this.defaultValue = defaultValue;\r
     }\r
 \r
     public Uint32(final List<RangeConstraint> rangeStatements,\r
-            final Long defaultValue) {\r
-        super(name, description, reference, rangeStatements);\r
-        this.defaultValue = defaultValue;\r
-    }\r
-\r
-    public Uint32(final String units, final Long defaultValue) {\r
-        super(name, description, reference, units);\r
+            final String units, final Long defaultValue) {\r
+        super(name, description, rangeStatements, units);\r
         this.defaultValue = defaultValue;\r
     }\r
 \r
     /*\r
      * (non-Javadoc)\r
      * \r
-     * @see org.opendaylight.controller.yang.model.api.TypeDefinition#getBaseType()\r
+     * @see\r
+     * org.opendaylight.controller.yang.model.api.TypeDefinition#getBaseType()\r
      */\r
     @Override\r
-    public IntegerTypeDefinition getBaseType() {\r
+    public UnsignedIntegerTypeDefinition getBaseType() {\r
         return this;\r
     }\r
 \r
     /*\r
      * (non-Javadoc)\r
      * \r
-     * @see org.opendaylight.controller.yang.model.api.TypeDefinition#getDefaultValue()\r
+     * @see\r
+     * org.opendaylight.controller.yang.model.api.TypeDefinition#getDefaultValue\r
+     * ()\r
      */\r
     @Override\r
     public Object getDefaultValue() {\r
index 8ac7c39affa781f6053f8eebd9eea0ff44dece7d..e17a4dc4df8783bdc4efe2fcc8a6252af0d427bc 100644 (file)
@@ -1,60 +1,65 @@
 /*\r
 * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.\r
 *\r
 * This program and the accompanying materials are made available under the\r
 * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
 * and is available at http://www.eclipse.org/legal/epl-v10.html\r
 */\r
+ * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.\r
+ *\r
+ * This program and the accompanying materials are made available under the\r
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
+ * and is available at http://www.eclipse.org/legal/epl-v10.html\r
+ */\r
 package org.opendaylight.controller.model.util;\r
 \r
 import java.math.BigInteger;\r
 import java.util.List;\r
 \r
-import org.opendaylight.controller.model.api.type.IntegerTypeDefinition;\r
 import org.opendaylight.controller.model.api.type.RangeConstraint;\r
+import org.opendaylight.controller.model.api.type.UnsignedIntegerTypeDefinition;\r
 import org.opendaylight.controller.yang.common.QName;\r
 \r
-public class Uint64 extends AbstractInteger {\r
+/**\r
+ * Implementation of Yang uint64 built-in type. <br>\r
+ * uint64 represents integer values between 0 and 18446744073709551615,\r
+ * inclusively. The Java counterpart of Yang uint64 built-in type is\r
+ * {@link BigInteger}.\r
+ * \r
+ */\r
+public class Uint64 extends AbstractUnsignedInteger {\r
 \r
     private static final QName name = BaseTypes.constructQName("uint32");\r
     private BigInteger defaultValue = null;\r
-    private static final String description = "";\r
-    private static final String reference = "";\r
+    private static final String description = \r
+            "uint64 represents integer values between 0 and 18446744073709551615, inclusively.";\r
 \r
     public Uint64() {\r
-        super(name, description, reference);\r
+        super(name, description, Short.MIN_VALUE, Short.MAX_VALUE, "");\r
     }\r
 \r
     public Uint64(final BigInteger defaultValue) {\r
-        super(name, description, reference);\r
+        super(name, description, Short.MIN_VALUE, Short.MAX_VALUE, "");\r
         this.defaultValue = defaultValue;\r
     }\r
 \r
     public Uint64(final List<RangeConstraint> rangeStatements,\r
-            final BigInteger defaultValue) {\r
-        super(name, description, reference, rangeStatements);\r
-        this.defaultValue = defaultValue;\r
-    }\r
-\r
-    public Uint64(final String units, final BigInteger defaultValue) {\r
-        super(name, description, reference, units);\r
+            final String units, final BigInteger defaultValue) {\r
+        super(name, description, rangeStatements, units);\r
         this.defaultValue = defaultValue;\r
     }\r
 \r
     /*\r
      * (non-Javadoc)\r
      * \r
-     * @see org.opendaylight.controller.yang.model.api.TypeDefinition#getBaseType()\r
+     * @see\r
+     * org.opendaylight.controller.yang.model.api.TypeDefinition#getBaseType()\r
      */\r
     @Override\r
-    public IntegerTypeDefinition getBaseType() {\r
+    public UnsignedIntegerTypeDefinition getBaseType() {\r
         return this;\r
     }\r
 \r
     /*\r
      * (non-Javadoc)\r
      * \r
-     * @see org.opendaylight.controller.yang.model.api.TypeDefinition#getDefaultValue()\r
+     * @see\r
+     * org.opendaylight.controller.yang.model.api.TypeDefinition#getDefaultValue\r
+     * ()\r
      */\r
     @Override\r
     public Object getDefaultValue() {\r
index 39314fe7183a2aa0b79ef6d7452991660fafc09f..d4429dccb34e20fd1071ad857e2ca11f86785e3d 100644 (file)
@@ -9,40 +9,37 @@ package org.opendaylight.controller.model.util;
 \r
 import java.util.List;\r
 \r
-import org.opendaylight.controller.model.api.type.IntegerTypeDefinition;\r
 import org.opendaylight.controller.model.api.type.RangeConstraint;\r
+import org.opendaylight.controller.model.api.type.UnsignedIntegerTypeDefinition;\r
 import org.opendaylight.controller.yang.common.QName;\r
 \r
-public class Uint8 extends AbstractInteger {\r
+/**\r
+ * Implementation of Yang uint8 built-in type.\r
+ * <br>\r
+ * uint8 represents integer values between 0 and 255, inclusively. The Java counterpart of \r
+ * Yang uint8 built-in type is {@link Short}.\r
+ * \r
+ * @see AbstractUnsignedInteger\r
+ */\r
+public class Uint8 extends AbstractUnsignedInteger {\r
 \r
     private static final QName name = BaseTypes.constructQName("uint8");\r
     private Short defaultValue = null;\r
-    private static final String description = "";\r
-    private static final String reference = "";\r
+    private static final String description = \r
+            "uint8  represents integer values between 0 and 255, inclusively.";\r
 \r
     public Uint8() {\r
-        super(name, description, reference);\r
+        super(name, description, Short.MIN_VALUE, Short.MAX_VALUE, "");\r
     }\r
 \r
     public Uint8(final Short defaultValue) {\r
-        super(name, description, reference);\r
-        this.defaultValue = defaultValue;\r
-    }\r
-\r
-    public Uint8(final List<RangeConstraint> rangeStatements,\r
-            final Short defaultValue) {\r
-        super(name, description, reference, rangeStatements);\r
-        this.defaultValue = defaultValue;\r
-    }\r
-\r
-    public Uint8(final String units, final Short defaultValue) {\r
-        super(name, description, reference, units);\r
+        super(name, description, Short.MIN_VALUE, Short.MAX_VALUE, "");\r
         this.defaultValue = defaultValue;\r
     }\r
 \r
     public Uint8(final List<RangeConstraint> rangeStatements,\r
             final String units, final Short defaultValue) {\r
-        super(name, description, reference, units, rangeStatements);\r
+        super(name, description, rangeStatements, units);\r
         this.defaultValue = defaultValue;\r
     }\r
 \r
@@ -52,7 +49,7 @@ public class Uint8 extends AbstractInteger {
      * @see org.opendaylight.controller.yang.model.api.TypeDefinition#getBaseType()\r
      */\r
     @Override\r
-    public IntegerTypeDefinition getBaseType() {\r
+    public UnsignedIntegerTypeDefinition getBaseType() {\r
         return this;\r
     }\r
 \r
index f0b5ddd2865f2c34aec5eb70c3b7eedc23d7798a..1553ce0d762ecb39fd1f5b774f5103b4ed741170 100644 (file)
@@ -15,7 +15,6 @@ import org.opendaylight.controller.model.api.type.PatternConstraint;
 import org.opendaylight.controller.model.api.type.RangeConstraint;\r
 import org.opendaylight.controller.model.api.type.UnknownTypeDefinition;\r
 import org.opendaylight.controller.yang.common.QName;\r
-import org.opendaylight.controller.yang.model.api.ExtensionDefinition;\r
 import org.opendaylight.controller.yang.model.api.SchemaPath;\r
 import org.opendaylight.controller.yang.model.api.Status;\r
 import org.opendaylight.controller.yang.model.api.UnknownSchemaNode;\r
index a09d27e340bbab323b4679ad0d212a9963cb83eb..7f485c3c204c654b8425c6559bf684cefec281e7 100644 (file)
@@ -20,6 +20,7 @@ import org.opendaylight.controller.model.api.type.DecimalTypeDefinition;
 import org.opendaylight.controller.model.api.type.IntegerTypeDefinition;\r
 import org.opendaylight.controller.model.api.type.RangeConstraint;\r
 import org.opendaylight.controller.model.api.type.StringTypeDefinition;\r
+import org.opendaylight.controller.model.api.type.UnsignedIntegerTypeDefinition;\r
 import org.opendaylight.controller.yang.common.QName;\r
 import org.opendaylight.controller.yang.model.api.TypeDefinition;\r
 \r
@@ -36,10 +37,10 @@ public class YangTypesConverter {
     private static final TypeDefinition<IntegerTypeDefinition> INT32_TYPE = new Int32();\r
     private static final TypeDefinition<IntegerTypeDefinition> INT64_TYPE = new Int64();\r
     private static final TypeDefinition<StringTypeDefinition> STRING_TYPE = new StringType();\r
-    private static final TypeDefinition<IntegerTypeDefinition> UINT8_TYPE = new Uint8();\r
-    private static final TypeDefinition<IntegerTypeDefinition> UINT16_TYPE = new Int16();\r
-    private static final TypeDefinition<IntegerTypeDefinition> UINT32_TYPE = new Int32();\r
-    private static final TypeDefinition<IntegerTypeDefinition> UINT64_TYPE = new Int64();\r
+    private static final TypeDefinition<UnsignedIntegerTypeDefinition> UINT8_TYPE = new Uint8();\r
+    private static final TypeDefinition<UnsignedIntegerTypeDefinition> UINT16_TYPE = new Uint16();\r
+    private static final TypeDefinition<UnsignedIntegerTypeDefinition> UINT32_TYPE = new Uint32();\r
+    private static final TypeDefinition<UnsignedIntegerTypeDefinition> UINT64_TYPE = new Uint64();\r
 \r
     static {\r
         baseYangTypeMap.put("binary", BINARY);\r
@@ -90,24 +91,30 @@ public class YangTypesConverter {
         return type;\r
     }\r
 \r
-    public static TypeDefinition<IntegerTypeDefinition> javaTypeForBaseYangIntegerType(\r
-            String typeName, List<RangeConstraint> ranges) {\r
+    public static TypeDefinition<IntegerTypeDefinition> javaTypeForBaseYangSignedIntegerType(\r
+            String typeName) {\r
         if (typeName.equals("int8")) {\r
-            return new Int8(ranges, null);\r
+            return new Int8();\r
         } else if (typeName.equals("int16")) {\r
-            return new Int16(ranges, null);\r
+            return new Int16();\r
         } else if (typeName.equals("int32")) {\r
-            return new Int32(ranges, null);\r
+            return new Int32();\r
         } else if (typeName.equals("int64")) {\r
-            return new Int64(ranges, null);\r
-        } else if (typeName.equals("uint8")) {\r
-            return new Uint8(ranges, null);\r
+            return new Int64();\r
+        }\r
+        return null;\r
+    }\r
+\r
+    public static TypeDefinition<UnsignedIntegerTypeDefinition> javaTypeForBaseYangUnsignedIntegerType(\r
+            final String typeName) {\r
+        if (typeName.equals("uint8")) {\r
+            return new Uint8();\r
         } else if (typeName.equals("uint16")) {\r
-            return new Uint16(ranges, null);\r
+            return new Uint16();\r
         } else if (typeName.equals("uint32")) {\r
-            return new Uint32(ranges, null);\r
+            return new Uint32();\r
         } else if (typeName.equals("uint64")) {\r
-            return new Uint64(ranges, null);\r
+            return new Uint64();\r
         }\r
         return null;\r
     }\r