Fixed bugs in parsing enumeration, augment, identity. 54/654/1
authorMartin Vitez <mvitez@cisco.com>
Thu, 25 Apr 2013 11:54:16 +0000 (13:54 +0200)
committerMartin Vitez <mvitez@cisco.com>
Wed, 24 Jul 2013 11:44:52 +0000 (13:44 +0200)
Refactored SchemaPath construction for int, uint, decimal64, string and union types.

Signed-off-by: Martin Vitez <mvitez@cisco.com>
13 files changed:
yang-model-util/src/main/java/org/opendaylight/controller/yang/model/util/AbstractSignedInteger.java
yang-model-util/src/main/java/org/opendaylight/controller/yang/model/util/AbstractUnsignedInteger.java
yang-model-util/src/main/java/org/opendaylight/controller/yang/model/util/Decimal64.java
yang-model-util/src/main/java/org/opendaylight/controller/yang/model/util/Int16.java
yang-model-util/src/main/java/org/opendaylight/controller/yang/model/util/Int32.java
yang-model-util/src/main/java/org/opendaylight/controller/yang/model/util/Int64.java
yang-model-util/src/main/java/org/opendaylight/controller/yang/model/util/Int8.java
yang-model-util/src/main/java/org/opendaylight/controller/yang/model/util/StringType.java
yang-model-util/src/main/java/org/opendaylight/controller/yang/model/util/Uint16.java
yang-model-util/src/main/java/org/opendaylight/controller/yang/model/util/Uint32.java
yang-model-util/src/main/java/org/opendaylight/controller/yang/model/util/Uint64.java
yang-model-util/src/main/java/org/opendaylight/controller/yang/model/util/Uint8.java
yang-model-util/src/main/java/org/opendaylight/controller/yang/model/util/YangTypesConverter.java

index 366df63971a80ef7b34153b413e98451c7a6c936..3907cc13e5d4bc314619885644935a9a74875ced 100644 (file)
@@ -7,8 +7,10 @@
  */
 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;
@@ -23,7 +25,7 @@ import org.opendaylight.controller.yang.model.api.type.RangeConstraint;
  * 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>
@@ -32,7 +34,7 @@ import org.opendaylight.controller.yang.model.api.type.RangeConstraint;
  * <li>int64 - represents integer values between -9223372036854775808 and
  * 9223372036854775807, inclusively.</li>
  * </ul>
- * 
+ *
  */
 public abstract class AbstractSignedInteger implements IntegerTypeDefinition {
 
@@ -51,17 +53,20 @@ public abstract class AbstractSignedInteger implements IntegerTypeDefinition {
      * @param maxRange
      * @param units
      */
-    public AbstractSignedInteger(final QName name, final String description,
-            final Number minRange, final Number maxRange, final String units) {
+    public AbstractSignedInteger(final List<String> actualPath,
+            final URI namespace, final Date revision, 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.path = BaseTypes.schemaPath(actualPath, namespace, revision);
         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"));
+                maxRange, rangeDescription,
+                "https://tools.ietf.org/html/rfc6020#section-9.2.4"));
     }
 
     /**
@@ -70,11 +75,13 @@ public abstract class AbstractSignedInteger implements IntegerTypeDefinition {
      * @param rangeStatements
      * @param units
      */
-    public AbstractSignedInteger(final QName name, final String description,
+    public AbstractSignedInteger(final List<String> actualPath,
+            final URI namespace, final Date revision, 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.path = BaseTypes.schemaPath(actualPath, namespace, revision);
         this.units = units;
         this.rangeStatements = rangeStatements;
     }
index c444ce9fddef9125a1ba32fa5979bccc84964a11..76048519e7f226653f220aa73aff85dae7ed5681 100644 (file)
@@ -1,10 +1,12 @@
 /**
- * 
+ *
  */
 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;
@@ -17,16 +19,16 @@ import org.opendaylight.controller.yang.model.api.type.UnsignedIntegerTypeDefini
 /**
  * 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:
- * 
+ * 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>uint32 - represents integer values between 0 and 4294967295, inclusively.
</li>
  * <li>uint64 - represents integer values between 0 and 18446744073709551615,
     inclusively.</li>
* inclusively.</li>
  * </ul>
  *
  */
@@ -39,7 +41,7 @@ public abstract class AbstractUnsignedInteger implements
 
     private final String units;
     private final List<RangeConstraint> rangeStatements;
-    
+
     /**
      * @param name
      * @param description
@@ -47,17 +49,20 @@ public abstract class AbstractUnsignedInteger implements
      * @param maxRange
      * @param units
      */
-    public AbstractUnsignedInteger(final QName name, final String description,
-            final Number minRange, final Number maxRange, final String units) {
+    public AbstractUnsignedInteger(final List<String> actualPath,
+            final URI namespace, final Date revision, 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.path = BaseTypes.schemaPath(actualPath, namespace, revision);
         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"));
+                maxRange, rangeDescription,
+                "https://tools.ietf.org/html/rfc6020#section-9.2.4"));
     }
 
     /**
@@ -66,15 +71,17 @@ public abstract class AbstractUnsignedInteger implements
      * @param rangeStatements
      * @param units
      */
-    public AbstractUnsignedInteger(final QName name, final String description,
+    public AbstractUnsignedInteger(final List<String> actualPath,
+            final URI namespace, final Date revision, 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.path = BaseTypes.schemaPath(actualPath, namespace, revision);
         this.units = units;
         this.rangeStatements = rangeStatements;
     }
-    
+
     @Override
     public String getUnits() {
         return units;
index a1073c60cf598d768d3cfd488896d81f0bb82ed2..158865aec9dff12a3d21f50b8e06f08e2beec151 100644 (file)
@@ -8,8 +8,10 @@
 package org.opendaylight.controller.yang.model.util;
 
 import java.math.BigDecimal;
+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;
@@ -21,8 +23,8 @@ import org.opendaylight.controller.yang.model.api.type.RangeConstraint;
 
 /**
  * The <code>default</code> implementation of Decimal Type Definition interface.
- * 
- * 
+ *
+ *
  * @see DecimalTypeDefinition
  */
 public class Decimal64 implements DecimalTypeDefinition {
@@ -52,14 +54,15 @@ public class Decimal64 implements DecimalTypeDefinition {
      * inclusively as defined interface {@link DecimalTypeDefinition} <br>
      * If the fraction digits are not defined inner the definition boundaries
      * the constructor will throw {@link IllegalArgumentException}
-     * 
+     *
      * @param fractionDigits
      *            integer between 1 and 18 inclusively
-     * 
+     *
      * @see DecimalTypeDefinition
      * @exception IllegalArgumentException
      */
-    public Decimal64(final Integer fractionDigits) {
+    public Decimal64(final List<String> actualPath, final URI namespace,
+            final Date revision, final Integer fractionDigits) {
         super();
         if (!((fractionDigits.intValue() > 1) && (fractionDigits.intValue() <= 18))) {
             throw new IllegalArgumentException(
@@ -67,12 +70,12 @@ public class Decimal64 implements DecimalTypeDefinition {
         }
         this.fractionDigits = fractionDigits;
         rangeStatements = defaultRangeStatements();
-        this.path = BaseTypes.schemaPath(name);
+        this.path = BaseTypes.schemaPath(actualPath, namespace, revision);
     }
 
     /**
      * Decimal64 Type Constructor. <br>
-     * 
+     *
      * If parameter <code>Range Statements</code> is <code>null</code> or
      * defined as <code>empty List</code> the constructor automatically assigns
      * the boundaries as min and max value defined for Decimal64 in <a
@@ -83,14 +86,15 @@ public class Decimal64 implements DecimalTypeDefinition {
      * inclusively as defined interface {@link DecimalTypeDefinition} <br>
      * If the fraction digits are not defined inner the definition boundaries
      * the constructor will throw {@link IllegalArgumentException}
-     * 
+     *
      * @param rangeStatements
      *            Range Constraint Statements
      * @param fractionDigits
      *            integer between 1 and 18 inclusively
      * @exception IllegalArgumentException
      */
-    public Decimal64(final List<RangeConstraint> rangeStatements,
+    public Decimal64(final List<String> actualPath, final URI namespace,
+            final Date revision, final List<RangeConstraint> rangeStatements,
             Integer fractionDigits) {
         super();
         if (!((fractionDigits.intValue() > 1) && (fractionDigits.intValue() <= 18))) {
@@ -103,7 +107,7 @@ public class Decimal64 implements DecimalTypeDefinition {
             this.rangeStatements = Collections.unmodifiableList(rangeStatements);
         }
         this.fractionDigits = fractionDigits;
-        this.path = BaseTypes.schemaPath(name);
+        this.path = BaseTypes.schemaPath(actualPath, namespace, revision);
     }
 
     /**
@@ -118,7 +122,7 @@ public class Decimal64 implements DecimalTypeDefinition {
      * inclusively as defined interface {@link DecimalTypeDefinition} <br>
      * If the fraction digits are not defined inner the definition boundaries
      * the constructor will throw {@link IllegalArgumentException}
-     * 
+     *
      * @param units
      *            units associated with the type
      * @param defaultValue
@@ -127,10 +131,11 @@ public class Decimal64 implements DecimalTypeDefinition {
      *            Range Constraint Statements
      * @param fractionDigits
      *            integer between 1 and 18 inclusively
-     * 
+     *
      * @exception IllegalArgumentException
      */
-    public Decimal64(final String units, final BigDecimal defaultValue,
+    public Decimal64(final List<String> actualPath, final URI namespace,
+            final Date revision, final String units, final BigDecimal defaultValue,
             final List<RangeConstraint> rangeStatements,
             final Integer fractionDigits) {
         super();
@@ -141,7 +146,7 @@ public class Decimal64 implements DecimalTypeDefinition {
 
         if (rangeStatements == null || rangeStatements.isEmpty()) {
             this.rangeStatements = defaultRangeStatements();
-            
+
         } else {
             this.rangeStatements = Collections.unmodifiableList(rangeStatements);
         }
@@ -153,7 +158,7 @@ public class Decimal64 implements DecimalTypeDefinition {
 
     /**
      * Returns unmodifiable List with default definition of Range Statements.
-     * 
+     *
      * @return unmodifiable List with default definition of Range Statements.
      */
     private List<RangeConstraint> defaultRangeStatements() {
index 40857d1c32526fcca3b1c0f16dfe246fc2dcf107..750dff5c7a5e9d88094c728f097a7e1c0ca81809 100644 (file)
@@ -7,6 +7,8 @@
  */
 package org.opendaylight.controller.yang.model.util;
 
+import java.net.URI;
+import java.util.Date;
 import java.util.List;
 
 import org.opendaylight.controller.yang.common.QName;
@@ -17,23 +19,25 @@ import org.opendaylight.controller.yang.model.api.type.RangeConstraint;
  * Implementation of Yang int16 built-in type. <br>
  * int16 represents integer values between -32768 and 32767, inclusively. The
  * Java counterpart of Yang int16 built-in type is {@link Short}.
- * 
+ *
  * @see AbstractSignedInteger
  */
 public class Int16 extends AbstractSignedInteger {
 
     private static final QName name = BaseTypes.constructQName("int16");
     private Short defaultValue = null;
-    private static final String description = 
+    private static final String description =
             "int16  represents integer values between -32768 and 32767, inclusively.";
 
-    public Int16() {
-        super(name, description, Short.MIN_VALUE, Short.MAX_VALUE, "");
+    public Int16(final List<String> actualPath, final URI namespace,
+            final Date revision) {
+        super(actualPath, namespace, revision, name, description, Short.MIN_VALUE, Short.MAX_VALUE, "");
     }
 
-    public Int16(final List<RangeConstraint> rangeStatements,
+    public Int16(final List<String> actualPath, final URI namespace,
+            final Date revision, final List<RangeConstraint> rangeStatements,
             final String units, final Short defaultValue) {
-        super(name, description, rangeStatements, units);
+        super(actualPath, namespace, revision, name, description, rangeStatements, units);
         this.defaultValue = defaultValue;
     }
 
index 06e1948d681319c4aaeef38eb600385441a9401b..da356309a504735f5644eced96fbebedd81addf2 100644 (file)
@@ -7,6 +7,8 @@
  */
 package org.opendaylight.controller.yang.model.util;
 
+import java.net.URI;
+import java.util.Date;
 import java.util.List;
 
 import org.opendaylight.controller.yang.common.QName;
@@ -18,35 +20,38 @@ import org.opendaylight.controller.yang.model.api.type.RangeConstraint;
  * int32 represents integer values between -2147483648 and 2147483647,
  * inclusively. The Java counterpart of Yang int32 built-in type is
  * {@link Integer}.
- * 
+ *
  * @see AbstractSignedInteger
- * 
+ *
  */
 public class Int32 extends AbstractSignedInteger {
 
     private static final QName name = BaseTypes.constructQName("int32");
     private Integer defaultValue = null;
-    private static final String description = 
+    private static final String description =
             "int32  represents integer values between -2147483648 and 2147483647, inclusively.";
 
-    public Int32() {
-        super(name, description, Integer.MIN_VALUE, Integer.MAX_VALUE, "");
+    public Int32(final List<String> actualPath, final URI namespace,
+            final Date revision) {
+        super(actualPath, namespace, revision, name, description, Integer.MIN_VALUE, Integer.MAX_VALUE, "");
     }
 
-    public Int32(final Integer defaultValue) {
-        super(name, description, Integer.MIN_VALUE, Integer.MAX_VALUE, "");
+    public Int32(final List<String> actualPath, final URI namespace,
+            final Date revision, final Integer defaultValue) {
+        super(actualPath, namespace, revision, name, description, Integer.MIN_VALUE, Integer.MAX_VALUE, "");
         this.defaultValue = defaultValue;
     }
 
-    public Int32(final List<RangeConstraint> rangeStatements,
+    public Int32(final List<String> actualPath, final URI namespace,
+            final Date revision, final List<RangeConstraint> rangeStatements,
             final String units, final Integer defaultValue) {
-        super(name, description, rangeStatements, units);
+        super(actualPath, namespace, revision, name, description, rangeStatements, units);
         this.defaultValue = defaultValue;
     }
 
     /*
      * (non-Javadoc)
-     * 
+     *
      * @see
      * org.opendaylight.controller.yang.model.api.TypeDefinition#getBaseType()
      */
@@ -57,7 +62,7 @@ public class Int32 extends AbstractSignedInteger {
 
     /*
      * (non-Javadoc)
-     * 
+     *
      * @see
      * org.opendaylight.controller.yang.model.api.TypeDefinition#getDefaultValue
      * ()
index f858539dc343bdcb4714fecb34c313ce4f8c7d63..4b05bc59e72a9f011f36809e864a9b767217451d 100644 (file)
@@ -7,6 +7,8 @@
   */
 package org.opendaylight.controller.yang.model.util;
 
+import java.net.URI;
+import java.util.Date;
 import java.util.List;
 
 import org.opendaylight.controller.yang.common.QName;
@@ -15,7 +17,7 @@ import org.opendaylight.controller.yang.model.api.type.RangeConstraint;
 
 /**
  * Implementation of Yang int64 built-in type. <br>
- * int64  represents integer values between -9223372036854775808 and 9223372036854775807, inclusively. 
+ * int64  represents integer values between -9223372036854775808 and 9223372036854775807, inclusively.
  * The Java counterpart of Yang int64 built-in type is
  * {@link Long}.
  *
@@ -24,27 +26,30 @@ public class Int64 extends AbstractSignedInteger {
 
     private static final QName name = BaseTypes.constructQName("int64");
     private Long defaultValue = null;
-    private static final String description = 
+    private static final String description =
             "int64  represents integer values between -9223372036854775808 and 9223372036854775807, inclusively.";
 
-    public Int64() {
-        super(name, description, Integer.MIN_VALUE, Integer.MAX_VALUE, "");
+    public Int64(final List<String> actualPath, final URI namespace,
+            final Date revision) {
+        super(actualPath, namespace, revision, name, description, Integer.MIN_VALUE, Integer.MAX_VALUE, "");
     }
 
-    public Int64(final Long defaultValue) {
-        super(name, description, Integer.MIN_VALUE, Integer.MAX_VALUE, "");
+    public Int64(final List<String> actualPath, final URI namespace,
+            final Date revision, final Long defaultValue) {
+        super(actualPath, namespace, revision, name, description, Integer.MIN_VALUE, Integer.MAX_VALUE, "");
         this.defaultValue = defaultValue;
     }
 
-    public Int64(final List<RangeConstraint> rangeStatements,
+    public Int64(final List<String> actualPath, final URI namespace,
+            final Date revision, final List<RangeConstraint> rangeStatements,
             final String units, final Long defaultValue) {
-        super(name, description, rangeStatements, units);
+        super(actualPath, namespace, revision, name, description, rangeStatements, units);
         this.defaultValue = defaultValue;
     }
 
     /*
      * (non-Javadoc)
-     * 
+     *
      * @see org.opendaylight.controller.yang.model.api.TypeDefinition#getBaseType()
      */
     @Override
@@ -54,7 +59,7 @@ public class Int64 extends AbstractSignedInteger {
 
     /*
      * (non-Javadoc)
-     * 
+     *
      * @see org.opendaylight.controller.yang.model.api.TypeDefinition#getDefaultValue()
      */
     @Override
index a263fd19091acaa65ef8af574c4f6fe18a66d4e7..6a917b252f4bd916bca5359add44bc4dd3c1262b 100644 (file)
@@ -7,6 +7,8 @@
   */
 package org.opendaylight.controller.yang.model.util;
 
+import java.net.URI;
+import java.util.Date;
 import java.util.List;
 
 import org.opendaylight.controller.yang.common.QName;
@@ -16,36 +18,39 @@ import org.opendaylight.controller.yang.model.api.type.RangeConstraint;
 /**
  * Implementation of Yang int8 built-in type.
  * <br>
- * int8 represents integer values between -128 and 127, inclusively. The Java counterpart of 
+ * int8 represents integer values between -128 and 127, inclusively. The Java counterpart of
  * Yang int8 built-in type is {@link Byte}.
- * 
+ *
  * @see AbstractSignedInteger
  */
 public class Int8 extends AbstractSignedInteger {
 
     private static final QName name = BaseTypes.constructQName("int8");
     private Byte defaultValue = null;
-    private static final String description = 
+    private static final String description =
             "represents integer values between -128 and 127, inclusively.";
-    
-    public Int8() {
-        super(name, description, Byte.MIN_VALUE, Byte.MAX_VALUE, "");
+
+    public Int8(final List<String> actualPath, final URI namespace,
+            final Date revision) {
+        super(actualPath, namespace, revision, name, description, Byte.MIN_VALUE, Byte.MAX_VALUE, "");
     }
 
-    public Int8(final Byte defaultValue) {
-        super(name, description, Byte.MIN_VALUE, Byte.MAX_VALUE, "");
+    public Int8(final List<String> actualPath, final URI namespace,
+            final Date revision, final Byte defaultValue) {
+        super(actualPath, namespace, revision, name, description, Byte.MIN_VALUE, Byte.MAX_VALUE, "");
         this.defaultValue = defaultValue;
     }
 
-    public Int8(final List<RangeConstraint> rangeStatements,
+    public Int8(final List<String> actualPath, final URI namespace,
+            final Date revision, final List<RangeConstraint> rangeStatements,
             final String units, final Byte defaultValue) {
-        super(name, description, rangeStatements, units);
+        super(actualPath, namespace, revision, name, description, rangeStatements, units);
         this.defaultValue = defaultValue;
     }
 
     /*
      * (non-Javadoc)
-     * 
+     *
      * @see org.opendaylight.controller.yang.model.api.TypeDefinition#getBaseType()
      */
     @Override
@@ -55,7 +60,7 @@ public class Int8 extends AbstractSignedInteger {
 
     /*
      * (non-Javadoc)
-     * 
+     *
      * @see org.opendaylight.controller.yang.model.api.TypeDefinition#getDefaultValue()
      */
     @Override
index c676d7479a16ce13205a1662b503c2080783974e..f58075bf307d9d6d2bd4f2012620dc4970426c7a 100644 (file)
@@ -7,8 +7,10 @@
   */
 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;
@@ -38,9 +40,10 @@ public class StringType implements StringTypeDefinition {
     /**
      * Default Constructor.
      */
-    public StringType() {
+    public StringType(final List<String> actualPath,
+            final URI namespace, final Date revision) {
         super();
-        path = BaseTypes.schemaPath(name);
+        path = BaseTypes.schemaPath(actualPath, namespace, revision);
         final List<LengthConstraint> constraints = new ArrayList<LengthConstraint>();
         constraints.add(BaseConstraints.lengthConstraint(0, Long.MAX_VALUE, "", ""));
         lengthStatements = Collections.unmodifiableList(constraints);
@@ -54,10 +57,11 @@ public class StringType implements StringTypeDefinition {
      * @param lengthStatements
      * @param patterns
      */
-    public StringType(final List<LengthConstraint> lengthStatements,
+    public StringType(final List<String> actualPath,
+            final URI namespace, final Date revision, final List<LengthConstraint> lengthStatements,
             final List<PatternConstraint> patterns) {
         super();
-        path = BaseTypes.schemaPath(name);
+        path = BaseTypes.schemaPath(actualPath, namespace, revision);
         if(lengthStatements == null || lengthStatements.size() == 0) {
             final List<LengthConstraint> constraints = new ArrayList<LengthConstraint>();
             constraints.add(BaseConstraints.lengthConstraint(0, Long.MAX_VALUE, "", ""));
@@ -76,11 +80,12 @@ public class StringType implements StringTypeDefinition {
      * @param patterns
      * @param units
      */
-    public StringType(final String defaultValue,
+    public StringType(final List<String> actualPath,
+            final URI namespace, final Date revision, final String defaultValue,
             final List<LengthConstraint> lengthStatements,
             final List<PatternConstraint> patterns, final String units) {
         super();
-        path = BaseTypes.schemaPath(name);
+        path = BaseTypes.schemaPath(actualPath, namespace, revision);
         this.defaultValue = defaultValue;
         if(lengthStatements == null || lengthStatements.size() == 0) {
             final List<LengthConstraint> constraints = new ArrayList<LengthConstraint>();
index f58c765886b76b10aa2b3b65e5926aec4e676e91..9db4ea9df878cdbc72da18ef30ebd431a99d0fdb 100644 (file)
@@ -7,6 +7,8 @@
  */
 package org.opendaylight.controller.yang.model.util;
 
+import java.net.URI;
+import java.util.Date;
 import java.util.List;
 
 import org.opendaylight.controller.yang.common.QName;
@@ -17,7 +19,7 @@ import org.opendaylight.controller.yang.model.api.type.UnsignedIntegerTypeDefini
  * Implementation of Yang uint32 built-in type. <br>
  * uint16 represents integer values between 0 and 65535, inclusively. The Java
  * counterpart of Yang uint32 built-in type is {@link Integer}.
- * 
+ *
  */
 public class Uint16 extends AbstractUnsignedInteger {
 
@@ -25,24 +27,27 @@ public class Uint16 extends AbstractUnsignedInteger {
     private Integer defaultValue = null;
     private static final String description = "uint16 represents integer values between 0 and 65535, inclusively.";
 
-    public Uint16() {
-        super(name, description, Short.MIN_VALUE, Short.MAX_VALUE, "");
+    public Uint16(final List<String> actualPath,
+            final URI namespace, final Date revision) {
+        super(actualPath, namespace, revision, name, description, Short.MIN_VALUE, Short.MAX_VALUE, "");
     }
 
-    public Uint16(final Integer defaultValue) {
-        super(name, description, Short.MIN_VALUE, Short.MAX_VALUE, "");
+    public Uint16(final List<String> actualPath,
+            final URI namespace, final Date revision, final Integer defaultValue) {
+        super(actualPath, namespace, revision, name, description, Short.MIN_VALUE, Short.MAX_VALUE, "");
         this.defaultValue = defaultValue;
     }
 
-    public Uint16(final List<RangeConstraint> rangeStatements,
+    public Uint16(final List<String> actualPath,
+            final URI namespace, final Date revision, final List<RangeConstraint> rangeStatements,
             final String units, final Integer defaultValue) {
-        super(name, description, rangeStatements, units);
+        super(actualPath, namespace, revision, name, description, rangeStatements, units);
         this.defaultValue = defaultValue;
     }
 
     /*
      * (non-Javadoc)
-     * 
+     *
      * @see
      * org.opendaylight.controller.yang.model.api.TypeDefinition#getBaseType()
      */
@@ -53,7 +58,7 @@ public class Uint16 extends AbstractUnsignedInteger {
 
     /*
      * (non-Javadoc)
-     * 
+     *
      * @see
      * org.opendaylight.controller.yang.model.api.TypeDefinition#getDefaultValue
      * ()
index ba2e4ea8d9acc50c7087942cef01fc3780cc5bb7..75f9b49693e41ad01015156b31836334c02e330f 100644 (file)
@@ -7,6 +7,8 @@
  */
 package org.opendaylight.controller.yang.model.util;
 
+import java.net.URI;
+import java.util.Date;
 import java.util.List;
 
 import org.opendaylight.controller.yang.common.QName;
@@ -17,7 +19,7 @@ import org.opendaylight.controller.yang.model.api.type.UnsignedIntegerTypeDefini
  * Implementation of Yang uint32 built-in type. <br>
  * uint32 represents integer values between 0 and 4294967295, inclusively. The
  * Java counterpart of Yang uint32 built-in type is {@link Long}.
- * 
+ *
  */
 public class Uint32 extends AbstractUnsignedInteger {
 
@@ -25,24 +27,27 @@ public class Uint32 extends AbstractUnsignedInteger {
     private Long defaultValue = null;
     private static final String description = "uint32 represents integer values between 0 and 4294967295, inclusively.";
 
-    public Uint32() {
-        super(name, description, Short.MIN_VALUE, Short.MAX_VALUE, "");
+    public Uint32(final List<String> actualPath,
+            final URI namespace, final Date revision) {
+        super(actualPath, namespace, revision, name, description, Short.MIN_VALUE, Short.MAX_VALUE, "");
     }
 
-    public Uint32(final Long defaultValue) {
-        super(name, description, Short.MIN_VALUE, Short.MAX_VALUE, "");
+    public Uint32(final List<String> actualPath,
+            final URI namespace, final Date revision, final Long defaultValue) {
+        super(actualPath, namespace, revision, name, description, Short.MIN_VALUE, Short.MAX_VALUE, "");
         this.defaultValue = defaultValue;
     }
 
-    public Uint32(final List<RangeConstraint> rangeStatements,
+    public Uint32(final List<String> actualPath,
+            final URI namespace, final Date revision, final List<RangeConstraint> rangeStatements,
             final String units, final Long defaultValue) {
-        super(name, description, rangeStatements, units);
+        super(actualPath, namespace, revision, name, description, rangeStatements, units);
         this.defaultValue = defaultValue;
     }
 
     /*
      * (non-Javadoc)
-     * 
+     *
      * @see
      * org.opendaylight.controller.yang.model.api.TypeDefinition#getBaseType()
      */
@@ -53,7 +58,7 @@ public class Uint32 extends AbstractUnsignedInteger {
 
     /*
      * (non-Javadoc)
-     * 
+     *
      * @see
      * org.opendaylight.controller.yang.model.api.TypeDefinition#getDefaultValue
      * ()
index c247c2a4da3c9044eaf54a626b0c4ed5310c48e6..05ea8c9e0983f98687a950fc8c2cffbc841c1328 100644 (file)
@@ -8,6 +8,8 @@
 package org.opendaylight.controller.yang.model.util;
 
 import java.math.BigInteger;
+import java.net.URI;
+import java.util.Date;
 import java.util.List;
 
 import org.opendaylight.controller.yang.common.QName;
@@ -29,18 +31,21 @@ public class Uint64 extends AbstractUnsignedInteger {
     private static final String description =
             "uint64 represents integer values between 0 and 18446744073709551615, inclusively.";
 
-    public Uint64() {
-        super(name, description, Short.MIN_VALUE, Short.MAX_VALUE, "");
+    public Uint64(final List<String> actualPath,
+            final URI namespace, final Date revision) {
+        super(actualPath, namespace, revision, name, description, Short.MIN_VALUE, Short.MAX_VALUE, "");
     }
 
-    public Uint64(final BigInteger defaultValue) {
-        super(name, description, Short.MIN_VALUE, Short.MAX_VALUE, "");
+    public Uint64(final List<String> actualPath,
+            final URI namespace, final Date revision, final BigInteger defaultValue) {
+        super(actualPath, namespace, revision, name, description, Short.MIN_VALUE, Short.MAX_VALUE, "");
         this.defaultValue = defaultValue;
     }
 
-    public Uint64(final List<RangeConstraint> rangeStatements,
+    public Uint64(final List<String> actualPath,
+            final URI namespace, final Date revision, final List<RangeConstraint> rangeStatements,
             final String units, final BigInteger defaultValue) {
-        super(name, description, rangeStatements, units);
+        super(actualPath, namespace, revision, name, description, rangeStatements, units);
         this.defaultValue = defaultValue;
     }
 
index 57126a34de55cd9a661494be0edaccd85e149fe3..aa1e6cacfbf3e315b0604d35114df1360f6e325b 100644 (file)
@@ -7,6 +7,8 @@
   */
 package org.opendaylight.controller.yang.model.util;
 
+import java.net.URI;
+import java.util.Date;
 import java.util.List;
 
 import org.opendaylight.controller.yang.common.QName;
@@ -16,36 +18,39 @@ import org.opendaylight.controller.yang.model.api.type.UnsignedIntegerTypeDefini
 /**
  * Implementation of Yang uint8 built-in type.
  * <br>
- * uint8 represents integer values between 0 and 255, inclusively. The Java counterpart of 
+ * uint8 represents integer values between 0 and 255, inclusively. The Java counterpart of
  * Yang uint8 built-in type is {@link Short}.
- * 
+ *
  * @see AbstractUnsignedInteger
  */
 public class Uint8 extends AbstractUnsignedInteger {
 
     private static final QName name = BaseTypes.constructQName("uint8");
     private Short defaultValue = null;
-    private static final String description = 
+    private static final String description =
             "uint8  represents integer values between 0 and 255, inclusively.";
 
-    public Uint8() {
-        super(name, description, Short.MIN_VALUE, Short.MAX_VALUE, "");
+    public Uint8(final List<String> actualPath,
+            final URI namespace, final Date revision) {
+        super(actualPath, namespace, revision, name, description, Short.MIN_VALUE, Short.MAX_VALUE, "");
     }
 
-    public Uint8(final Short defaultValue) {
-        super(name, description, Short.MIN_VALUE, Short.MAX_VALUE, "");
+    public Uint8(final List<String> actualPath,
+            final URI namespace, final Date revision, final Short defaultValue) {
+        super(actualPath, namespace, revision, name, description, Short.MIN_VALUE, Short.MAX_VALUE, "");
         this.defaultValue = defaultValue;
     }
 
-    public Uint8(final List<RangeConstraint> rangeStatements,
+    public Uint8(final List<String> actualPath,
+            final URI namespace, final Date revision, final List<RangeConstraint> rangeStatements,
             final String units, final Short defaultValue) {
-        super(name, description, rangeStatements, units);
+        super(actualPath, namespace, revision, name, description, rangeStatements, units);
         this.defaultValue = defaultValue;
     }
 
     /*
      * (non-Javadoc)
-     * 
+     *
      * @see org.opendaylight.controller.yang.model.api.TypeDefinition#getBaseType()
      */
     @Override
@@ -55,7 +60,7 @@ public class Uint8 extends AbstractUnsignedInteger {
 
     /*
      * (non-Javadoc)
-     * 
+     *
      * @see org.opendaylight.controller.yang.model.api.TypeDefinition#getDefaultValue()
      */
     @Override
index f04ba66256fa695a73d72659b1c1b10e14661895..f3db85cf9a0242ab0f90d2753e0d1408368e4b36 100644 (file)
@@ -7,6 +7,8 @@
  */\r
 package org.opendaylight.controller.yang.model.util;\r
 \r
+import java.net.URI;\r
+import java.util.Date;\r
 import java.util.HashMap;\r
 import java.util.HashSet;\r
 import java.util.List;\r
@@ -18,13 +20,8 @@ import org.opendaylight.controller.yang.model.api.TypeDefinition;
 import org.opendaylight.controller.yang.model.api.type.BinaryTypeDefinition;\r
 import org.opendaylight.controller.yang.model.api.type.BitsTypeDefinition;\r
 import org.opendaylight.controller.yang.model.api.type.BooleanTypeDefinition;\r
-import org.opendaylight.controller.yang.model.api.type.DecimalTypeDefinition;\r
 import org.opendaylight.controller.yang.model.api.type.EmptyTypeDefinition;\r
 import org.opendaylight.controller.yang.model.api.type.InstanceIdentifierTypeDefinition;\r
-import org.opendaylight.controller.yang.model.api.type.IntegerTypeDefinition;\r
-import org.opendaylight.controller.yang.model.api.type.RangeConstraint;\r
-import org.opendaylight.controller.yang.model.api.type.StringTypeDefinition;\r
-import org.opendaylight.controller.yang.model.api.type.UnsignedIntegerTypeDefinition;\r
 \r
 public class YangTypesConverter {\r
 \r
@@ -35,16 +32,8 @@ public class YangTypesConverter {
     private static final TypeDefinition<BitsTypeDefinition> BITS = new BitsType();\r
     private static final TypeDefinition<BooleanTypeDefinition> BOOLEAN_TYPE = new BooleanType();\r
     private static final TypeDefinition<EmptyTypeDefinition> EMPTY_TYPE = new EmptyType();\r
-    private static final TypeDefinition<InstanceIdentifierTypeDefinition> INST_ID_TYPE = new InstanceIdentifier(null, true);\r
-    private static final TypeDefinition<IntegerTypeDefinition> INT8_TYPE = new Int8();\r
-    private static final TypeDefinition<IntegerTypeDefinition> INT16_TYPE = new Int16();\r
-    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<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
+    private static final TypeDefinition<InstanceIdentifierTypeDefinition> INST_ID_TYPE = new InstanceIdentifier(\r
+            null, true);\r
 \r
     static {\r
         baseYangTypeMap.put("binary", BINARY);\r
@@ -52,15 +41,6 @@ public class YangTypesConverter {
         baseYangTypeMap.put("boolean", BOOLEAN_TYPE);\r
         baseYangTypeMap.put("empty", EMPTY_TYPE);\r
         baseYangTypeMap.put("instance-identifier", INST_ID_TYPE);\r
-        baseYangTypeMap.put("int8", INT8_TYPE);\r
-        baseYangTypeMap.put("int16", INT16_TYPE);\r
-        baseYangTypeMap.put("int32", INT32_TYPE);\r
-        baseYangTypeMap.put("int64", INT64_TYPE);\r
-        baseYangTypeMap.put("string", STRING_TYPE);\r
-        baseYangTypeMap.put("uint8", UINT8_TYPE);\r
-        baseYangTypeMap.put("uint16", UINT16_TYPE);\r
-        baseYangTypeMap.put("uint32", UINT32_TYPE);\r
-        baseYangTypeMap.put("uint64", UINT64_TYPE);\r
 \r
         baseYangTypes.add("binary");\r
         baseYangTypes.add("bits");\r
@@ -92,42 +72,36 @@ public class YangTypesConverter {
         return type;\r
     }\r
 \r
-    public static TypeDefinition<?> javaTypeForBaseYangType(String typeName) {\r
-        TypeDefinition<?> type = baseYangTypeMap.get(typeName);\r
-        return type;\r
-    }\r
+    public static TypeDefinition<?> javaTypeForBaseYangType(\r
+            List<String> actualPath, URI namespace, Date revision,\r
+            String typeName) {\r
 \r
-    public static TypeDefinition<IntegerTypeDefinition> javaTypeForBaseYangSignedIntegerType(\r
-            String typeName, List<RangeConstraint> ranges) {\r
-        if (typeName.equals("int8")) {\r
-            return new Int8(ranges, null, null);\r
-        } else if (typeName.equals("int16")) {\r
-            return new Int16(ranges, null, null);\r
-        } else if (typeName.equals("int32")) {\r
-            return new Int32(ranges, null, null);\r
-        } else if (typeName.equals("int64")) {\r
-            return new Int64(ranges, null, null);\r
+        if (typeName.startsWith("int")) {\r
+            if (typeName.equals("int8")) {\r
+                return new Int8(actualPath, namespace, revision);\r
+            } else if (typeName.equals("int16")) {\r
+                return new Int16(actualPath, namespace, revision);\r
+            } else if (typeName.equals("int32")) {\r
+                return new Int32(actualPath, namespace, revision);\r
+            } else if (typeName.equals("int64")) {\r
+                return new Int64(actualPath, namespace, revision);\r
+            }\r
+        } else if (typeName.startsWith("uint")) {\r
+            if (typeName.equals("uint8")) {\r
+                return new Uint8(actualPath, namespace, revision);\r
+            } else if (typeName.equals("uint16")) {\r
+                return new Uint16(actualPath, namespace, revision);\r
+            } else if (typeName.equals("uint32")) {\r
+                return new Uint32(actualPath, namespace, revision);\r
+            } else if (typeName.equals("uint64")) {\r
+                return new Uint64(actualPath, namespace, revision);\r
+            }\r
+        } else if (typeName.equals("string")) {\r
+            return new StringType(actualPath, namespace, revision);\r
         }\r
-        return null;\r
-    }\r
 \r
-    public static TypeDefinition<UnsignedIntegerTypeDefinition> javaTypeForBaseYangUnsignedIntegerType(\r
-            final String typeName, List<RangeConstraint> ranges) {\r
-        if (typeName.equals("uint8")) {\r
-            return new Uint8(ranges, null, null);\r
-        } else if (typeName.equals("uint16")) {\r
-            return new Uint16(ranges, null, null);\r
-        } else if (typeName.equals("uint32")) {\r
-            return new Uint32(ranges, null, null);\r
-        } else if (typeName.equals("uint64")) {\r
-            return new Uint64(ranges, null, null);\r
-        }\r
-        return null;\r
-    }\r
-\r
-    public static TypeDefinition<DecimalTypeDefinition> javaTypeForBaseYangDecimal64Type(\r
-            List<RangeConstraint> rangeStatements, int fractionDigits) {\r
-        return new Decimal64(rangeStatements, fractionDigits);\r
+        TypeDefinition<?> type = baseYangTypeMap.get(typeName);\r
+        return type;\r
     }\r
 \r
-}
+}\r