Fixed bugs in naming conventions of packages.
[controller.git] / opendaylight / sal / yang-prototype / yang / yang-model-util / src / main / java / org / opendaylight / controller / yang / model / util / ExtendedType.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.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.TypeDefinition;\r
-import org.opendaylight.controller.yang.model.api.UnknownSchemaNode;\r
-\r
-public class ExtendedType implements TypeDefinition {\r
-\r
-    private final QName typeName;\r
-    private final TypeDefinition<?> baseType;\r
-    private final SchemaPath path;\r
-    private final String description;\r
-    private final String reference;\r
-    private final List<UnknownSchemaNode> unknownSchemaNodes;\r
-\r
-    private Status status;\r
-    private String units;\r
-    private Object defaultValue;\r
-\r
-    public static class Builder {\r
-        private final QName typeName;\r
-        private final TypeDefinition<?> baseType;\r
-\r
-        private final SchemaPath path;\r
-        private final String description;\r
-        private final String reference;\r
-\r
-        private List<UnknownSchemaNode> unknownSchemaNodes = Collections.emptyList();;\r
-        private Status status = Status.CURRENT;\r
-        private String units = "";\r
-        private Object defaultValue = null;\r
-\r
-        public Builder(final QName typeName, TypeDefinition<?> baseType,\r
-                final String description, final String reference) {\r
-            this.typeName = typeName;\r
-            this.baseType = baseType;\r
-            this.path = BaseTypes.schemaPath(typeName);\r
-            this.description = description;\r
-            this.reference = reference;\r
-        }\r
-\r
-        public Builder status(Status status) {\r
-            this.status = status;\r
-            return this;\r
-        }\r
-\r
-        public Builder units(String units) {\r
-            this.units = units;\r
-            return this;\r
-        }\r
-\r
-        public Builder defaultValue(final Object defaultValue) {\r
-            this.defaultValue = defaultValue;\r
-            return this;\r
-        }\r
-\r
-        public Builder unknownSchemaNodes(final List<UnknownSchemaNode> unknownSchemaNodes) {\r
-            this.unknownSchemaNodes = unknownSchemaNodes;\r
-            return this;\r
-        }\r
-\r
-        public ExtendedType build() {\r
-            return new ExtendedType(this);\r
-        }\r
-    }\r
-\r
-    private ExtendedType(Builder builder) {\r
-        this.typeName = builder.typeName;\r
-        this.baseType = builder.baseType;\r
-        this.path = builder.path;\r
-        this.description = builder.description;\r
-        this.reference = builder.reference;\r
-        this.unknownSchemaNodes = builder.unknownSchemaNodes;\r
-        this.status = builder.status;\r
-        this.units = builder.units;\r
-        this.defaultValue = builder.defaultValue;\r
-    }\r
-\r
-    @Override\r
-    public TypeDefinition<?> getBaseType() {\r
-        return baseType;\r
-    }\r
-\r
-    @Override\r
-    public String getUnits() {\r
-        return units;\r
-    }\r
-\r
-    @Override\r
-    public Object getDefaultValue() {\r
-        return defaultValue;\r
-    }\r
-\r
-    @Override\r
-    public QName getQName() {\r
-        return typeName;\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;\r
-    }\r
-\r
-    @Override\r
-    public List<UnknownSchemaNode> getUnknownSchemaNodes() {\r
-        return unknownSchemaNodes;\r
-    }\r
-\r
-    @Override\r
-    public int hashCode() {\r
-        final int prime = 31;\r
-        int result = 1;\r
-        result = prime * result\r
-                + ((baseType == null) ? 0 : baseType.hashCode());\r
-        result = prime * result\r
-                + ((defaultValue == null) ? 0 : defaultValue.hashCode());\r
-        result = prime * result\r
-                + ((description == null) ? 0 : description.hashCode());\r
-        result = prime * result\r
-                + ((unknownSchemaNodes == null) ? 0 : unknownSchemaNodes.hashCode());\r
-        result = prime * result + ((path == null) ? 0 : path.hashCode());\r
-        result = prime * result\r
-                + ((reference == null) ? 0 : reference.hashCode());\r
-        result = prime * result + ((status == null) ? 0 : status.hashCode());\r
-        result = prime * result\r
-                + ((typeName == null) ? 0 : typeName.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
-        ExtendedType other = (ExtendedType) obj;\r
-        if (baseType == null) {\r
-            if (other.baseType != null) {\r
-                return false;\r
-            }\r
-        } else if (!baseType.equals(other.baseType)) {\r
-            return false;\r
-        }\r
-        if (defaultValue == null) {\r
-            if (other.defaultValue != null) {\r
-                return false;\r
-            }\r
-        } else if (!defaultValue.equals(other.defaultValue)) {\r
-            return false;\r
-        }\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 (unknownSchemaNodes == null) {\r
-            if (other.unknownSchemaNodes != null) {\r
-                return false;\r
-            }\r
-        } else if (!unknownSchemaNodes.equals(other.unknownSchemaNodes)) {\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 (reference == null) {\r
-            if (other.reference != null) {\r
-                return false;\r
-            }\r
-        } else if (!reference.equals(other.reference)) {\r
-            return false;\r
-        }\r
-        if (status != other.status) {\r
-            return false;\r
-        }\r
-        if (typeName == null) {\r
-            if (other.typeName != null) {\r
-                return false;\r
-            }\r
-        } else if (!typeName.equals(other.typeName)) {\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 builder2 = new StringBuilder();\r
-        builder2.append("ExtendedType [typeName=");\r
-        builder2.append(typeName);\r
-        builder2.append(", baseType=");\r
-        builder2.append(baseType);\r
-        builder2.append(", path=");\r
-        builder2.append(path);\r
-        builder2.append(", description=");\r
-        builder2.append(description);\r
-        builder2.append(", reference=");\r
-        builder2.append(reference);\r
-        builder2.append(", unknownSchemaNodes=");\r
-        builder2.append(unknownSchemaNodes);\r
-        builder2.append(", status=");\r
-        builder2.append(status);\r
-        builder2.append(", units=");\r
-        builder2.append(units);\r
-        builder2.append(", defaultValue=");\r
-        builder2.append(defaultValue);\r
-        builder2.append("]");\r
-        return builder2.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.yang.model.util;
+
+import java.util.Collections;
+import java.util.List;
+
+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.TypeDefinition;
+import org.opendaylight.controller.yang.model.api.UnknownSchemaNode;
+
+public class ExtendedType implements TypeDefinition {
+
+    private final QName typeName;
+    private final TypeDefinition<?> baseType;
+    private final SchemaPath path;
+    private final String description;
+    private final String reference;
+    private final List<UnknownSchemaNode> unknownSchemaNodes;
+
+    private Status status;
+    private String units;
+    private Object defaultValue;
+
+    public static class Builder {
+        private final QName typeName;
+        private final TypeDefinition<?> baseType;
+
+        private final SchemaPath path;
+        private final String description;
+        private final String reference;
+
+        private List<UnknownSchemaNode> unknownSchemaNodes = Collections.emptyList();;
+        private Status status = Status.CURRENT;
+        private String units = "";
+        private Object defaultValue = null;
+
+        public Builder(final QName typeName, TypeDefinition<?> baseType,
+                final String description, final String reference) {
+            this.typeName = typeName;
+            this.baseType = baseType;
+            this.path = BaseTypes.schemaPath(typeName);
+            this.description = description;
+            this.reference = reference;
+        }
+
+        public Builder status(Status status) {
+            this.status = status;
+            return this;
+        }
+
+        public Builder units(String units) {
+            this.units = units;
+            return this;
+        }
+
+        public Builder defaultValue(final Object defaultValue) {
+            this.defaultValue = defaultValue;
+            return this;
+        }
+
+        public Builder unknownSchemaNodes(final List<UnknownSchemaNode> unknownSchemaNodes) {
+            this.unknownSchemaNodes = unknownSchemaNodes;
+            return this;
+        }
+
+        public ExtendedType build() {
+            return new ExtendedType(this);
+        }
+    }
+
+    private ExtendedType(Builder builder) {
+        this.typeName = builder.typeName;
+        this.baseType = builder.baseType;
+        this.path = builder.path;
+        this.description = builder.description;
+        this.reference = builder.reference;
+        this.unknownSchemaNodes = builder.unknownSchemaNodes;
+        this.status = builder.status;
+        this.units = builder.units;
+        this.defaultValue = builder.defaultValue;
+    }
+
+    @Override
+    public TypeDefinition<?> getBaseType() {
+        return baseType;
+    }
+
+    @Override
+    public String getUnits() {
+        return units;
+    }
+
+    @Override
+    public Object getDefaultValue() {
+        return defaultValue;
+    }
+
+    @Override
+    public QName getQName() {
+        return typeName;
+    }
+
+    @Override
+    public SchemaPath getPath() {
+        return path;
+    }
+
+    @Override
+    public String getDescription() {
+        return description;
+    }
+
+    @Override
+    public String getReference() {
+        return reference;
+    }
+
+    @Override
+    public Status getStatus() {
+        return status;
+    }
+
+    @Override
+    public List<UnknownSchemaNode> getUnknownSchemaNodes() {
+        return unknownSchemaNodes;
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result
+                + ((baseType == null) ? 0 : baseType.hashCode());
+        result = prime * result
+                + ((defaultValue == null) ? 0 : defaultValue.hashCode());
+        result = prime * result
+                + ((description == null) ? 0 : description.hashCode());
+        result = prime * result
+                + ((unknownSchemaNodes == null) ? 0 : unknownSchemaNodes.hashCode());
+        result = prime * result + ((path == null) ? 0 : path.hashCode());
+        result = prime * result
+                + ((reference == null) ? 0 : reference.hashCode());
+        result = prime * result + ((status == null) ? 0 : status.hashCode());
+        result = prime * result
+                + ((typeName == null) ? 0 : typeName.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;
+        }
+        ExtendedType other = (ExtendedType) obj;
+        if (baseType == null) {
+            if (other.baseType != null) {
+                return false;
+            }
+        } else if (!baseType.equals(other.baseType)) {
+            return false;
+        }
+        if (defaultValue == null) {
+            if (other.defaultValue != null) {
+                return false;
+            }
+        } else if (!defaultValue.equals(other.defaultValue)) {
+            return false;
+        }
+        if (description == null) {
+            if (other.description != null) {
+                return false;
+            }
+        } else if (!description.equals(other.description)) {
+            return false;
+        }
+        if (unknownSchemaNodes == null) {
+            if (other.unknownSchemaNodes != null) {
+                return false;
+            }
+        } else if (!unknownSchemaNodes.equals(other.unknownSchemaNodes)) {
+            return false;
+        }
+        if (path == null) {
+            if (other.path != null) {
+                return false;
+            }
+        } 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 (status != other.status) {
+            return false;
+        }
+        if (typeName == null) {
+            if (other.typeName != null) {
+                return false;
+            }
+        } else if (!typeName.equals(other.typeName)) {
+            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 builder2 = new StringBuilder();
+        builder2.append("ExtendedType [typeName=");
+        builder2.append(typeName);
+        builder2.append(", baseType=");
+        builder2.append(baseType);
+        builder2.append(", path=");
+        builder2.append(path);
+        builder2.append(", description=");
+        builder2.append(description);
+        builder2.append(", reference=");
+        builder2.append(reference);
+        builder2.append(", unknownSchemaNodes=");
+        builder2.append(unknownSchemaNodes);
+        builder2.append(", status=");
+        builder2.append(status);
+        builder2.append(", units=");
+        builder2.append(units);
+        builder2.append(", defaultValue=");
+        builder2.append(defaultValue);
+        builder2.append("]");
+        return builder2.toString();
+    }
+}