Comments of source code.
[yangtools.git] / code-generator / binding-generator-util / src / main / java / org / opendaylight / yangtools / binding / generator / util / AbstractBaseType.java
index cf3ff19dc64ea6edb2552767302fef8b6466de2c..5707c78053b3635b8252554cc8e32f59a2b701cb 100644 (file)
-/*\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.yangtools.binding.generator.util;\r
-\r
-import org.opendaylight.yangtools.sal.binding.model.api.Type;\r
-\r
-public class AbstractBaseType implements Type {\r
-\r
-    private final String packageName;\r
-    private final String name;\r
-\r
-    @Override\r
-    public String getPackageName() {\r
-        return packageName;\r
-    }\r
-\r
-    @Override\r
-    public String getName() {\r
-        return name;\r
-    }\r
-\r
-    @Override\r
-    public String getFullyQualifiedName() {\r
-        if (packageName.isEmpty()) {\r
-            return name;\r
-        } else {\r
-            return packageName + "." + name;\r
-        }\r
-    }\r
-\r
-    protected AbstractBaseType(String pkName, String name) {\r
-        this.packageName = pkName;\r
-        this.name = name;\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\r
-                + ((packageName == null) ? 0 : packageName.hashCode());\r
-        return result;\r
-    }\r
-\r
-    @Override\r
-    public boolean equals(Object obj) {\r
-        if (this == obj)\r
-            return true;\r
-        if (obj == null)\r
-            return false;\r
-        if (getClass() != obj.getClass())\r
-            return false;\r
-        Type other = (Type) obj;\r
-        if (name == null) {\r
-            if (other.getName() != null)\r
-                return false;\r
-        } else if (!name.equals(other.getName()))\r
-            return false;\r
-        if (packageName == null) {\r
-            if (other.getPackageName() != null)\r
-                return false;\r
-        } else if (!packageName.equals(other.getPackageName()))\r
-            return false;\r
-        return true;\r
-    }\r
-\r
-    @Override\r
-    public String toString() {\r
-        if (packageName.isEmpty()) {\r
-            return "Type (" + name + ")";\r
-        }\r
-        return "Type (" + packageName + "." + name + ")";\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.yangtools.binding.generator.util;
+
+import org.opendaylight.yangtools.sal.binding.model.api.Type;
+
+/**
+ * It is used only as ancestor for other <code>Type</code>s
+ * 
+ */
+public class AbstractBaseType implements Type {
+
+    /**
+     * Name of the package to which this <code>Type</code> belongs.
+     */
+    private final String packageName;
+
+    /**
+     * Name of this <code>Type</code>.
+     */
+    private final String name;
+
+    @Override
+    public String getPackageName() {
+        return packageName;
+    }
+
+    @Override
+    public String getName() {
+        return name;
+    }
+
+    @Override
+    public String getFullyQualifiedName() {
+        if (packageName.isEmpty()) {
+            return name;
+        } else {
+            return packageName + "." + name;
+        }
+    }
+
+    /**
+     * Constructs the instance of this class with the concrete package name type
+     * name.
+     * 
+     * @param pkName
+     *            string with the package name to which this <code>Type</code>
+     *            belongs
+     * @param name
+     *            string with the name for this <code>Type</code>
+     */
+    protected AbstractBaseType(String pkName, String name) {
+        this.packageName = pkName;
+        this.name = name;
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + ((name == null) ? 0 : name.hashCode());
+        result = prime * result + ((packageName == null) ? 0 : packageName.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;
+        Type other = (Type) obj;
+        if (name == null) {
+            if (other.getName() != null)
+                return false;
+        } else if (!name.equals(other.getName()))
+            return false;
+        if (packageName == null) {
+            if (other.getPackageName() != null)
+                return false;
+        } else if (!packageName.equals(other.getPackageName()))
+            return false;
+        return true;
+    }
+
+    @Override
+    public String toString() {
+        if (packageName.isEmpty()) {
+            return "Type (" + name + ")";
+        }
+        return "Type (" + packageName + "." + name + ")";
+    }
+}