Refactored implementation of getBaseType method for yang built-in types.
[yangtools.git] / yang / yang-model-util / src / main / java / org / opendaylight / yangtools / yang / model / util / BitsType.java
index 6fa221df6e254e05218ea15381de4f6c1a6c5528..c53df1bc6aa71259f030a996bc4259f2d8378518 100644 (file)
@@ -28,10 +28,9 @@ public final class BitsType implements BitsTypeDefinition {
             + "That is, a bits value is a set of flags identified by small integer position "
             + "numbers starting at 0.  Each bit number has an assigned name.";
 
-    private final String reference = "https://tools.ietf.org/html/rfc6020#section-9.7";
-    private final BitsTypeDefinition baseType;
+    private static final String REFERENCE = "https://tools.ietf.org/html/rfc6020#section-9.7";
     private final List<Bit> bits;
-    private final String units = "";
+    private static final String UNITS = "";
 
     /**
      * Default constructor. <br>
@@ -43,7 +42,6 @@ public final class BitsType implements BitsTypeDefinition {
         super();
         this.bits = Collections.emptyList();
         this.path = path;
-        this.baseType = this;
     }
 
     /**
@@ -56,7 +54,6 @@ public final class BitsType implements BitsTypeDefinition {
         super();
         this.bits = Collections.unmodifiableList(bits);
         this.path = path;
-        this.baseType = this;
     }
 
     /*
@@ -67,7 +64,7 @@ public final class BitsType implements BitsTypeDefinition {
      */
     @Override
     public BitsTypeDefinition getBaseType() {
-        return baseType;
+        return null;
     }
 
     /*
@@ -77,7 +74,7 @@ public final class BitsType implements BitsTypeDefinition {
      */
     @Override
     public String getUnits() {
-        return units;
+        return UNITS;
     }
 
     /*
@@ -130,7 +127,7 @@ public final class BitsType implements BitsTypeDefinition {
      */
     @Override
     public String getReference() {
-        return reference;
+        return REFERENCE;
     }
 
     /*
@@ -161,8 +158,6 @@ public final class BitsType implements BitsTypeDefinition {
         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 + ((reference == null) ? 0 : reference.hashCode());
-        result = prime * result + ((units == null) ? 0 : units.hashCode());
         return result;
     }
 
@@ -206,20 +201,6 @@ public final class BitsType implements BitsTypeDefinition {
         } else if (!path.equals(other.path)) {
             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;
     }
 
@@ -233,11 +214,11 @@ public final class BitsType implements BitsTypeDefinition {
         builder.append(", description=");
         builder.append(description);
         builder.append(", reference=");
-        builder.append(reference);
+        builder.append(REFERENCE);
         builder.append(", bits=");
         builder.append(bits);
         builder.append(", units=");
-        builder.append(units);
+        builder.append(UNITS);
         builder.append("]");
         return builder.toString();
     }