ST defect fixes and review comments fixes

Change-Id: Ib8c56a88c19cd9aa23918d0f9e37c89e74cb0d13
diff --git a/utils/yangutils/src/main/java/org/onosproject/yangutils/translator/tojava/utils/MethodsGenerator.java b/utils/yangutils/src/main/java/org/onosproject/yangutils/translator/tojava/utils/MethodsGenerator.java
index e2e6211..6ca6829 100644
--- a/utils/yangutils/src/main/java/org/onosproject/yangutils/translator/tojava/utils/MethodsGenerator.java
+++ b/utils/yangutils/src/main/java/org/onosproject/yangutils/translator/tojava/utils/MethodsGenerator.java
@@ -19,6 +19,7 @@
 import org.onosproject.yangutils.translator.tojava.AttributeInfo;
 import org.onosproject.yangutils.utils.UtilConstants;
 import org.onosproject.yangutils.utils.io.impl.JavaDocGen;
+import org.onosproject.yangutils.utils.io.impl.YangIoUtils;
 
 /**
  * Generated methods for generated files based on the file type.
@@ -32,45 +33,6 @@
     }
 
     /**
-     * Returns the methods strings for builder class.
-     *
-     * @param attr attribute info
-     * @param className java class name
-     * @return method string for builder class
-     */
-    static String parseBuilderMethodString(AttributeInfo attr, String className) {
-        String attrQuaifiedType = "";
-        if (attr.getImportInfo().getPkgInfo() != null) {
-            attrQuaifiedType = attr.getImportInfo().getPkgInfo() + ".";
-        }
-        attrQuaifiedType = attrQuaifiedType + attr.getImportInfo().getClassInfo();
-
-        String overrideString = UtilConstants.NEW_LINE + UtilConstants.FOUR_SPACE_INDENTATION
-                + UtilConstants.OVERRIDE + UtilConstants.NEW_LINE;
-        String getterString = getGetterForClass(attr.getAttributeName(), attrQuaifiedType);
-        String setterString = getSetterForClass(attr.getAttributeName(), attrQuaifiedType, className);
-        return overrideString + getterString + UtilConstants.NEW_LINE + overrideString + setterString;
-    }
-
-    /**
-     * Returns the methods strings for builder class.
-     *
-     * @param attr attribute info
-     * @return method string for builder class
-     */
-    static String parseImplMethodString(AttributeInfo attr) {
-
-        String attrQuaifiedType = "";
-        if (attr.getImportInfo().getPkgInfo() != null) {
-            attrQuaifiedType = attr.getImportInfo().getPkgInfo() + ".";
-        }
-        attrQuaifiedType = attrQuaifiedType + attr.getImportInfo().getClassInfo();
-
-        return UtilConstants.NEW_LINE + UtilConstants.FOUR_SPACE_INDENTATION + UtilConstants.OVERRIDE
-                + UtilConstants.NEW_LINE + getGetterForClass(attr.getAttributeName(), attrQuaifiedType);
-    }
-
-    /**
      * Returns the methods strings for builder interface.
      *
      * @param attr attribute info
@@ -90,7 +52,7 @@
      */
     public static String parseBuilderInterfaceBuildMethodString(String name) {
 
-        return JavaDocGen.getJavaDoc(JavaDocGen.JavaDocType.BUILD, name)
+        return JavaDocGen.getJavaDoc(JavaDocGen.JavaDocType.BUILD, name, false)
                 + getBuildForInterface(name);
     }
 
@@ -103,14 +65,17 @@
     public static String getGetterString(AttributeInfo attr) {
 
         String returnType = "";
-        if (attr.getImportInfo().getPkgInfo() != null) {
+        boolean isList = attr.isListAttr();
+        if (attr.isQualifiedName() && (attr.getImportInfo().getPkgInfo() != null)) {
             returnType = attr.getImportInfo().getPkgInfo() + ".";
         }
 
         returnType = returnType + attr.getImportInfo().getClassInfo();
+        String attributeName = JavaIdentifierSyntax.getLowerCase(attr.getAttributeName());
 
-        return JavaDocGen.getJavaDoc(JavaDocGen.JavaDocType.GETTER, attr.getAttributeName())
-                + getGetterForInterface(attr.getAttributeName(), returnType)
+        return JavaDocGen.getJavaDoc(JavaDocGen.JavaDocType.GETTER, attributeName, isList) +
+
+                getGetterForInterface(attributeName, returnType, attr.isListAttr())
                 + UtilConstants.NEW_LINE;
     }
 
@@ -121,17 +86,20 @@
      * @param className java class name
      * @return setter string
      */
-    private static String getSetterString(AttributeInfo attr, String className) {
+    public static String getSetterString(AttributeInfo attr, String className) {
 
         String attrType = "";
-        if (attr.getImportInfo().getPkgInfo() != null) {
+        boolean isList = attr.isListAttr();
+        if (attr.isQualifiedName() && (attr.getImportInfo().getPkgInfo() != null)) {
             attrType = attr.getImportInfo().getPkgInfo() + ".";
         }
 
         attrType = attrType + attr.getImportInfo().getClassInfo();
+        String attributeName = JavaIdentifierSyntax.getLowerCase(attr.getAttributeName());
 
-        return JavaDocGen.getJavaDoc(JavaDocGen.JavaDocType.SETTER, attr.getAttributeName())
-                + getSetterForInterface(attr.getAttributeName(), attrType, className);
+        return JavaDocGen.getJavaDoc(JavaDocGen.JavaDocType.SETTER, attributeName, isList)
+                + getSetterForInterface(attributeName, attrType, className, attr.isListAttr())
+                + UtilConstants.NEW_LINE;
     }
 
     /**
@@ -142,21 +110,75 @@
      */
     public static String getConstructorString(String name) {
 
-        return JavaDocGen.getJavaDoc(JavaDocGen.JavaDocType.CONSTRUCTOR, name)
-                + getConstructor(name);
+        return JavaDocGen.getJavaDoc(JavaDocGen.JavaDocType.CONSTRUCTOR, name, false);
     }
 
     /**
      * Returns default constructor method string.
      *
-     * @param type generated file type
      * @param name class name
+     * @param modifierType modifier type
      * @return default constructor string
      */
-    public static String getDefaultConstructorString(int type, String name) {
+    public static String getDefaultConstructorString(String name, String modifierType) {
 
-        return JavaDocGen.getJavaDoc(JavaDocGen.JavaDocType.DEFAULT_CONSTRUCTOR, name)
-                + getDefaultConstructor(name + UtilConstants.BUILDER);
+        return JavaDocGen.getJavaDoc(JavaDocGen.JavaDocType.DEFAULT_CONSTRUCTOR, name, false)
+                + getDefaultConstructor(name, modifierType);
+    }
+
+    /**
+     * Returns default constructor method string.
+     *
+     * @param attr attribute info
+     * @param className class name
+     * @return default constructor string
+     */
+    public static String getTypeDefConstructor(AttributeInfo attr, String className) {
+
+        String attrQuaifiedType = "";
+        if (attr.isQualifiedName() && (attr.getImportInfo().getPkgInfo() != null)) {
+            attrQuaifiedType = attr.getImportInfo().getPkgInfo() + ".";
+        }
+        attrQuaifiedType = attrQuaifiedType + attr.getImportInfo().getClassInfo();
+        String attributeName = JavaIdentifierSyntax.getLowerCase(attr.getAttributeName());
+
+        if (!attr.isListAttr()) {
+            return getTypeDefConstructorString(attrQuaifiedType, attributeName, className);
+        }
+        String listAttr = getListString() + attrQuaifiedType + UtilConstants.DIAMOND_CLOSE_BRACKET;
+        return getTypeDefConstructorString(listAttr, attributeName, className);
+    }
+
+    /**
+     * Returns type def's constructor for attribute.
+     *
+     * @param type data type
+     * @param name attribute name
+     * @param className class name
+     * @return setter for type def's attribute
+     */
+    private static String getTypeDefConstructorString(String type, String name, String className) {
+
+        return UtilConstants.FOUR_SPACE_INDENTATION + UtilConstants.PUBLIC + UtilConstants.SPACE
+                + className + UtilConstants.OPEN_PARENTHESIS
+                + type + UtilConstants.SPACE + "value" + UtilConstants.CLOSE_PARENTHESIS
+                + UtilConstants.SPACE + UtilConstants.OPEN_CURLY_BRACKET + UtilConstants.NEW_LINE
+                + UtilConstants.EIGHT_SPACE_INDENTATION + UtilConstants.THIS
+                + UtilConstants.PERIOD + name + UtilConstants.SPACE + UtilConstants.EQUAL + UtilConstants.SPACE
+                + "value" + UtilConstants.SEMI_COLAN + UtilConstants.NEW_LINE + UtilConstants.FOUR_SPACE_INDENTATION
+                + UtilConstants.CLOSE_CURLY_BRACKET;
+    }
+
+    /**
+     * Returns check not null string.
+     *
+     * @param name attribute name
+     * @return check not null string
+     */
+    public static String getCheckNotNull(String name) {
+        return UtilConstants.EIGHT_SPACE_INDENTATION + UtilConstants.CHECK_NOT_NULL_STRING
+                + UtilConstants.OPEN_PARENTHESIS + name + UtilConstants.COMMA + UtilConstants.SPACE + name
+                + UtilConstants.CLOSE_PARENTHESIS + UtilConstants.SEMI_COLAN + UtilConstants.NEW_LINE;
     }
 
     /**
@@ -174,56 +196,171 @@
     /**
      * Returns the getter method strings for class file.
      *
-     * @param attrName name of the attribute
-     * @param attrType return type of attribute
+     * @param attr attribute info
      * @return getter method for class
      */
-    private static String getGetterForClass(String attrName, String attrType) {
+    public static String getGetterForClass(AttributeInfo attr) {
+
+        String attrQuaifiedType = "";
+        if (attr.isQualifiedName() && (attr.getImportInfo().getPkgInfo() != null)) {
+            attrQuaifiedType = attr.getImportInfo().getPkgInfo() + ".";
+        }
+        attrQuaifiedType = attrQuaifiedType + attr.getImportInfo().getClassInfo();
+        String attributeName = JavaIdentifierSyntax.getLowerCase(attr.getAttributeName());
+
+        if (!attr.isListAttr()) {
+            return getGetter(attrQuaifiedType, attributeName);
+        }
+        String listAttr = getListString() + attrQuaifiedType + UtilConstants.DIAMOND_CLOSE_BRACKET;
+        return getGetter(listAttr, attributeName);
+    }
+
+    /**
+     * Returns getter for attribute.
+     *
+     * @param type return type
+     * @param name attribute name
+     * @return getter for attribute
+     */
+    private static String getGetter(String type, String name) {
 
         return UtilConstants.FOUR_SPACE_INDENTATION + UtilConstants.PUBLIC + UtilConstants.SPACE
-                + attrType + UtilConstants.SPACE + UtilConstants.GET_METHOD_PREFIX
-                + JavaIdentifierSyntax.getCaptialCase(attrName) + UtilConstants.OPEN_PARENTHESIS
+                + type + UtilConstants.SPACE + UtilConstants.GET_METHOD_PREFIX
+                + JavaIdentifierSyntax.getCaptialCase(name) + UtilConstants.OPEN_PARENTHESIS
                 + UtilConstants.CLOSE_PARENTHESIS + UtilConstants.SPACE + UtilConstants.OPEN_CURLY_BRACKET
                 + UtilConstants.NEW_LINE + UtilConstants.EIGHT_SPACE_INDENTATION + UtilConstants.RETURN
-                + UtilConstants.SPACE + attrName + UtilConstants.SEMI_COLAN + UtilConstants.NEW_LINE
+                + UtilConstants.SPACE + name + UtilConstants.SEMI_COLAN + UtilConstants.NEW_LINE
                 + UtilConstants.FOUR_SPACE_INDENTATION + UtilConstants.CLOSE_CURLY_BRACKET;
     }
 
     /**
      * Returns the setter method strings for class file.
      *
-     * @param attrName name of the attribute
-     * @param attrType return type of attribute
+     * @param attr attribute info
      * @param className name of the class
      * @return setter method for class
      */
-    private static String getSetterForClass(String attrName, String attrType, String className) {
+    public static String getSetterForClass(AttributeInfo attr, String className) {
+
+        String attrQuaifiedType = "";
+        if (attr.isQualifiedName() && (attr.getImportInfo().getPkgInfo() != null)) {
+            attrQuaifiedType = attr.getImportInfo().getPkgInfo() + ".";
+        }
+        attrQuaifiedType = attrQuaifiedType + attr.getImportInfo().getClassInfo();
+        String attributeName = JavaIdentifierSyntax.getLowerCase(attr.getAttributeName());
+        if (!attr.isListAttr()) {
+            return getSetter(className, attributeName, attrQuaifiedType);
+        }
+        String listAttr = getListString() + attrQuaifiedType + UtilConstants.DIAMOND_CLOSE_BRACKET;
+        return getSetter(className, attributeName, listAttr);
+    }
+
+    /**
+     * Returns setter for attribute.
+     *
+     * @param className class name
+     * @param name attribute name
+     * @param type return type
+     * @return setter for attribute
+     */
+    private static String getSetter(String className, String name, String type) {
 
         return UtilConstants.FOUR_SPACE_INDENTATION + UtilConstants.PUBLIC + UtilConstants.SPACE
                 + className + UtilConstants.BUILDER + UtilConstants.SPACE + UtilConstants.SET_METHOD_PREFIX
-                + JavaIdentifierSyntax.getCaptialCase(attrName) + UtilConstants.OPEN_PARENTHESIS
-                + attrType + UtilConstants.SPACE + attrName + UtilConstants.CLOSE_PARENTHESIS
+                + JavaIdentifierSyntax.getCaptialCase(name) + UtilConstants.OPEN_PARENTHESIS
+                + type + UtilConstants.SPACE + name + UtilConstants.CLOSE_PARENTHESIS
                 + UtilConstants.SPACE + UtilConstants.OPEN_CURLY_BRACKET + UtilConstants.NEW_LINE
                 + UtilConstants.EIGHT_SPACE_INDENTATION + UtilConstants.THIS + UtilConstants.PERIOD
-                + attrName + UtilConstants.SPACE + UtilConstants.EQUAL + UtilConstants.SPACE + attrName
-                + UtilConstants.SEMI_COLAN + UtilConstants.NEW_LINE + UtilConstants.EIGHT_SPACE_INDENTATION
+                + name + UtilConstants.SPACE + UtilConstants.EQUAL + UtilConstants.SPACE
+                + name + UtilConstants.SEMI_COLAN + UtilConstants.NEW_LINE + UtilConstants.EIGHT_SPACE_INDENTATION
                 + UtilConstants.RETURN + UtilConstants.SPACE + UtilConstants.THIS + UtilConstants.SEMI_COLAN
                 + UtilConstants.NEW_LINE + UtilConstants.FOUR_SPACE_INDENTATION + UtilConstants.CLOSE_CURLY_BRACKET;
     }
 
     /**
+     * Returns the setter method strings for class file.
+     *
+     * @param attr attribute info
+     * @return setter method for class
+     */
+    public static String getSetterForTypeDefClass(AttributeInfo attr) {
+
+        String attrQuaifiedType = "";
+        if (attr.isQualifiedName() && (attr.getImportInfo().getPkgInfo() != null)) {
+            attrQuaifiedType = attr.getImportInfo().getPkgInfo() + ".";
+        }
+        attrQuaifiedType = attrQuaifiedType + attr.getImportInfo().getClassInfo();
+        String attributeName = JavaIdentifierSyntax.getLowerCase(attr.getAttributeName());
+
+        if (!attr.isListAttr()) {
+            return getTypeDefSetter(attrQuaifiedType, attributeName);
+        }
+        String listAttr = getListString() + attrQuaifiedType + UtilConstants.DIAMOND_CLOSE_BRACKET;
+        return getTypeDefSetter(listAttr, attributeName);
+    }
+
+    /**
+     * Returns type def's setter for attribute.
+     *
+     * @param type data type
+     * @param name attribute name
+     * @return setter for type def's attribute
+     */
+    private static String getTypeDefSetter(String type, String name) {
+
+        return UtilConstants.FOUR_SPACE_INDENTATION + UtilConstants.PUBLIC + UtilConstants.SPACE
+                + UtilConstants.VOID + UtilConstants.SPACE + UtilConstants.SET_METHOD_PREFIX
+                + JavaIdentifierSyntax.getCaptialCase(name) + UtilConstants.OPEN_PARENTHESIS
+                + type + UtilConstants.SPACE + "value" + UtilConstants.CLOSE_PARENTHESIS
+                + UtilConstants.SPACE + UtilConstants.OPEN_CURLY_BRACKET + UtilConstants.NEW_LINE
+                + UtilConstants.EIGHT_SPACE_INDENTATION + UtilConstants.THIS + UtilConstants.PERIOD
+                + name + UtilConstants.SPACE + UtilConstants.EQUAL + UtilConstants.SPACE
+                + "value" + UtilConstants.SEMI_COLAN + UtilConstants.NEW_LINE + UtilConstants.FOUR_SPACE_INDENTATION
+                + UtilConstants.CLOSE_CURLY_BRACKET;
+    }
+
+    /**
+     * Returns override string.
+     *
+     * @return override string
+     */
+    public static String getOverRideString() {
+        return UtilConstants.NEW_LINE + UtilConstants.FOUR_SPACE_INDENTATION
+                + UtilConstants.OVERRIDE + UtilConstants.NEW_LINE;
+    }
+
+    /**
      * Returns the getter method strings for interface file.
      *
      * @param yangName name of the attribute
      * @param returnType return type of attribute
+     * @param isList is list attribute
      * @return getter method for interface
      */
-    private static String getGetterForInterface(String yangName, String returnType) {
+    public static String getGetterForInterface(String yangName, String returnType, boolean isList) {
+
+        if (!isList) {
+            return getGetterInterfaceString(returnType, yangName);
+        }
+        String listAttr = getListString() + returnType + UtilConstants.DIAMOND_CLOSE_BRACKET;
+        return getGetterInterfaceString(listAttr, yangName);
+    }
+
+    /**
+     * Returns getter for attribute in interface.
+     *
+     * @param returnType return type
+     * @param yangName attribute name
+     * @return getter for interface
+     */
+    private static String getGetterInterfaceString(String returnType, String yangName) {
+
         return UtilConstants.FOUR_SPACE_INDENTATION + returnType
                 + UtilConstants.SPACE + UtilConstants.GET_METHOD_PREFIX
                 + JavaIdentifierSyntax.getCaptialCase(yangName)
                 + UtilConstants.OPEN_PARENTHESIS + UtilConstants.CLOSE_PARENTHESIS
                 + UtilConstants.SEMI_COLAN;
+
     }
 
     /**
@@ -232,9 +369,28 @@
      * @param attrName name of the attribute
      * @param attrType return type of attribute
      * @param className name of the java class being generated
+     * @param isList is list attribute
      * @return setter method for interface
      */
-    private static String getSetterForInterface(String attrName, String attrType, String className) {
+    public static String getSetterForInterface(String attrName, String attrType, String className, boolean isList) {
+
+        if (!isList) {
+            return getSetterInterfaceString(className, attrName, attrType);
+        }
+        String listAttr = getListString() + attrType + UtilConstants.DIAMOND_CLOSE_BRACKET;
+        return getSetterInterfaceString(className, attrName, listAttr);
+    }
+
+    /**
+     * Returns setter string for interface.
+     *
+     * @param className class name
+     * @param attrName attribute name
+     * @param attrType attribute type
+     * @return setter string
+     */
+    private static String getSetterInterfaceString(String className, String attrName, String attrType) {
+
         return UtilConstants.FOUR_SPACE_INDENTATION + className + UtilConstants.BUILDER
                 + UtilConstants.SPACE + UtilConstants.SET_METHOD_PREFIX
                 + JavaIdentifierSyntax.getCaptialCase(attrName) + UtilConstants.OPEN_PARENTHESIS
@@ -243,48 +399,47 @@
     }
 
     /**
+     * Returns list string.
+     *
+     * @return list string
+     */
+    private static String getListString() {
+        return UtilConstants.LIST + UtilConstants.DIAMOND_OPEN_BRACKET;
+    }
+
+    /**
      * Returns the build method strings for interface file.
      *
      * @param yangName name of the interface
      * @return build method for interface
      */
-    private static String getBuildForInterface(String yangName) {
+    public static String getBuildForInterface(String yangName) {
 
         return UtilConstants.FOUR_SPACE_INDENTATION + yangName + UtilConstants.SPACE + UtilConstants.BUILD
-                + UtilConstants.OPEN_PARENTHESIS + UtilConstants.CLOSE_PARENTHESIS + UtilConstants.SEMI_COLAN;
+                + UtilConstants.OPEN_PARENTHESIS + UtilConstants.CLOSE_PARENTHESIS + UtilConstants.SEMI_COLAN
+                + UtilConstants.NEW_LINE;
     }
 
     /**
      * Returns the constructor strings for class file.
      *
      * @param yangName name of the class
+     * @param attr attribute info
      * @return constructor for class
      */
-    private static String getConstructor(String yangName) {
+    public static String getConstructor(String yangName, AttributeInfo attr) {
 
-        String builderAttribute = yangName.substring(0, 1).toLowerCase() + yangName.substring(1);
-        String constructor = UtilConstants.FOUR_SPACE_INDENTATION + UtilConstants.PUBLIC + UtilConstants.SPACE
-                + yangName + UtilConstants.IMPL + UtilConstants.OPEN_PARENTHESIS + yangName + UtilConstants.BUILDER
-                + UtilConstants.SPACE + builderAttribute + UtilConstants.OBJECT + UtilConstants.CLOSE_PARENTHESIS
-                + UtilConstants.SPACE + UtilConstants.OPEN_CURLY_BRACKET + UtilConstants.NEW_LINE;
+        String builderAttribute = JavaIdentifierSyntax.getLowerCase(yangName);
+        String attributeName = JavaIdentifierSyntax.getLowerCase(attr.getAttributeName());
+        String constructor = UtilConstants.EIGHT_SPACE_INDENTATION + UtilConstants.THIS
+                + UtilConstants.PERIOD + JavaIdentifierSyntax.getCamelCase(attributeName)
+                + UtilConstants.SPACE + UtilConstants.EQUAL + UtilConstants.SPACE + builderAttribute
+                + UtilConstants.OBJECT + UtilConstants.PERIOD + UtilConstants.GET_METHOD_PREFIX
+                + JavaIdentifierSyntax.getCaptialCase(JavaIdentifierSyntax.getCamelCase(attributeName))
+                + UtilConstants.OPEN_PARENTHESIS + UtilConstants.CLOSE_PARENTHESIS + UtilConstants.SEMI_COLAN
+                + UtilConstants.NEW_LINE;
 
-        //        TODO: need to get the partial constructor from constructor temp file.
-        //        if (getAttrInfo() != null) {
-        //            for (AttributeInfo attribute : getAttrInfo()) {
-        //                attribute.setAttributeName(JavaIdentifierSyntax.getCamelCase(attribute.getAttributeName()));
-        //                constructor = constructor + UtilConstants.TWELVE_SPACE_INDENTATION + UtilConstants.THIS
-        //                        + UtilConstants.PERIOD + attribute.getAttributeName() + UtilConstants.SPACE
-        //                        + UtilConstants.EQUAL + UtilConstants.SPACE + builderAttribute + UtilConstants.OBJECT
-        //                        + UtilConstants.PERIOD + UtilConstants.GET_METHOD_PREFIX
-        //                        + JavaIdentifierSyntax.getCaptialCase(attribute.getAttributeName())
-        //                        + UtilConstants.OPEN_PARENTHESIS
-        //        + UtilConstants.CLOSE_PARENTHESIS + UtilConstants.SEMI_COLAN
-        //                        + UtilConstants.NEW_LINE;
-        //            }
-        //            getAttrInfo().clear();
-        //        }
-
-        return constructor + UtilConstants.FOUR_SPACE_INDENTATION + UtilConstants.CLOSE_CURLY_BRACKET;
+        return constructor;
     }
 
     /**
@@ -293,10 +448,10 @@
      * @param yangName class name
      * @return build method string for class
      */
-    private static String getBuild(String yangName) {
+    public static String getBuild(String yangName) {
 
-        return UtilConstants.FOUR_SPACE_INDENTATION + UtilConstants.PUBLIC + UtilConstants.SPACE + yangName
-                + UtilConstants.SPACE + UtilConstants.BUILD + UtilConstants.OPEN_PARENTHESIS
+        return UtilConstants.FOUR_SPACE_INDENTATION + UtilConstants.PUBLIC + UtilConstants.SPACE
+                + yangName + UtilConstants.SPACE + UtilConstants.BUILD + UtilConstants.OPEN_PARENTHESIS
                 + UtilConstants.CLOSE_PARENTHESIS + UtilConstants.SPACE + UtilConstants.OPEN_CURLY_BRACKET
                 + UtilConstants.NEW_LINE + UtilConstants.EIGHT_SPACE_INDENTATION + UtilConstants.RETURN
                 + UtilConstants.SPACE + UtilConstants.NEW + UtilConstants.SPACE + yangName + UtilConstants.IMPL
@@ -309,14 +464,205 @@
      * Returns the Default constructor strings for class file.
      *
      * @param name name of the class
+     * @param modifierType modifier type for default constructor
      * @return Default constructor for class
      */
-    private static String getDefaultConstructor(String name) {
+    private static String getDefaultConstructor(String name, String modifierType) {
 
-        return UtilConstants.FOUR_SPACE_INDENTATION + UtilConstants.PUBLIC + UtilConstants.SPACE + name
+        return UtilConstants.FOUR_SPACE_INDENTATION + modifierType + UtilConstants.SPACE + name
                 + UtilConstants.OPEN_PARENTHESIS + UtilConstants.CLOSE_PARENTHESIS + UtilConstants.SPACE
                 + UtilConstants.OPEN_CURLY_BRACKET + UtilConstants.NEW_LINE + UtilConstants.FOUR_SPACE_INDENTATION
                 + UtilConstants.CLOSE_CURLY_BRACKET + UtilConstants.NEW_LINE;
     }
 
+    /**
+     * Returns to string method open strings.
+     *
+     * @return to string method open string
+     */
+    public static String getToStringMethodOpen() {
+
+        return getOverRideString() + UtilConstants.FOUR_SPACE_INDENTATION + UtilConstants.PUBLIC + UtilConstants.SPACE
+                + UtilConstants.STRING + UtilConstants.SPACE + "to" + UtilConstants.STRING
+                + UtilConstants.OPEN_PARENTHESIS + UtilConstants.CLOSE_PARENTHESIS + UtilConstants.SPACE
+                + UtilConstants.OPEN_CURLY_BRACKET + UtilConstants.NEW_LINE + UtilConstants.EIGHT_SPACE_INDENTATION
+                + UtilConstants.RETURN + " MoreObjects.toStringHelper(getClass())" + UtilConstants.NEW_LINE;
+    }
+
+    /**
+     * Returns to string methods close string.
+     *
+     * @return to string method close string
+     */
+    public static String getToStringMethodClose() {
+        return UtilConstants.TWELVE_SPACE_INDENTATION + ".to" + UtilConstants.STRING
+                + UtilConstants.OPEN_PARENTHESIS + UtilConstants.CLOSE_PARENTHESIS + UtilConstants.SEMI_COLAN
+                + UtilConstants.NEW_LINE + UtilConstants.FOUR_SPACE_INDENTATION
+                + UtilConstants.CLOSE_CURLY_BRACKET;
+    }
+
+    /**
+     * To string method for class.
+     *
+     * @param attr attribute info
+     * @return to string method
+     */
+    public static String getToStringMethod(AttributeInfo attr) {
+        String attributeName = JavaIdentifierSyntax.getLowerCase(attr.getAttributeName());
+        return UtilConstants.TWELVE_SPACE_INDENTATION + UtilConstants.PERIOD + UtilConstants.ADD_STRING
+                + UtilConstants.OPEN_PARENTHESIS + UtilConstants.QUOTES
+                + attributeName + UtilConstants.QUOTES + UtilConstants.COMMA + UtilConstants.SPACE + attributeName
+                + UtilConstants.CLOSE_PARENTHESIS;
+
+    }
+
+    /**
+     * Returns to hash code method open strings.
+     *
+     * @return to hash code method open string
+     */
+    public static String getHashCodeMethodOpen() {
+
+        return getOverRideString() + UtilConstants.FOUR_SPACE_INDENTATION + UtilConstants.PUBLIC + UtilConstants.SPACE
+                + UtilConstants.INT + UtilConstants.SPACE + UtilConstants.HASH_CODE_STRING
+                + UtilConstants.OPEN_PARENTHESIS + UtilConstants.CLOSE_PARENTHESIS + UtilConstants.SPACE
+                + UtilConstants.OPEN_CURLY_BRACKET + UtilConstants.NEW_LINE + UtilConstants.EIGHT_SPACE_INDENTATION
+                + UtilConstants.RETURN + " Objects.hash" + UtilConstants.OPEN_PARENTHESIS;
+    }
+
+    /**
+     * Returns to hash code methods close string.
+     *
+     * @param hashcodeString hash code string
+     * @return to hash code method close string
+     */
+    public static String getHashCodeMethodClose(String hashcodeString) {
+        hashcodeString = YangIoUtils.trimAtLast(hashcodeString, UtilConstants.COMMA);
+        hashcodeString = YangIoUtils.trimAtLast(hashcodeString, UtilConstants.SPACE);
+        hashcodeString = YangIoUtils.partString(hashcodeString);
+        return hashcodeString + UtilConstants.CLOSE_PARENTHESIS + UtilConstants.SEMI_COLAN + UtilConstants.NEW_LINE
+                + UtilConstants.FOUR_SPACE_INDENTATION + UtilConstants.CLOSE_CURLY_BRACKET;
+    }
+
+    /**
+     * Hash code method for class.
+     *
+     * @param attr attribute info
+     * @return hash code method
+     */
+    public static String getHashCodeMethod(AttributeInfo attr) {
+        String attributeName = JavaIdentifierSyntax.getLowerCase(attr.getAttributeName());
+        return attributeName
+                + UtilConstants.COMMA + UtilConstants.SPACE;
+
+    }
+
+    /**
+     * Returns to equals method open strings.
+     *
+     * @param className class name
+     * @return to equals method open string
+     */
+    public static String getEqualsMethodOpen(String className) {
+
+        return getOverRideString() + UtilConstants.FOUR_SPACE_INDENTATION + UtilConstants.PUBLIC + UtilConstants.SPACE
+                + UtilConstants.BOOLEAN + UtilConstants.SPACE + UtilConstants.EQUALS_STRING
+                + UtilConstants.OPEN_PARENTHESIS + UtilConstants.OBJECT_STRING + UtilConstants.SPACE + "obj"
+                + UtilConstants.CLOSE_PARENTHESIS + UtilConstants.SPACE + UtilConstants.OPEN_CURLY_BRACKET
+                + UtilConstants.NEW_LINE + getEqualsMethodsCommonIfCondition()
+                + getEqualsMethodsSpecificIfCondition(className);
+    }
+
+    /**
+     * Returns equal methods if condition string.
+     *
+     * @return if condition string
+     */
+    private static String getEqualsMethodsCommonIfCondition() {
+        return UtilConstants.EIGHT_SPACE_INDENTATION + UtilConstants.IF + UtilConstants.SPACE
+                + UtilConstants.OPEN_PARENTHESIS + UtilConstants.THIS
+                + UtilConstants.SPACE + UtilConstants.EQUAL + UtilConstants.EQUAL + UtilConstants.SPACE + "obj"
+                + UtilConstants.CLOSE_PARENTHESIS + UtilConstants.SPACE + UtilConstants.OPEN_CURLY_BRACKET
+                + UtilConstants.NEW_LINE + UtilConstants.TWELVE_SPACE_INDENTATION + UtilConstants.RETURN
+                + UtilConstants.SPACE + UtilConstants.TRUE + UtilConstants.SEMI_COLAN + UtilConstants.NEW_LINE
+                + UtilConstants.EIGHT_SPACE_INDENTATION + UtilConstants.CLOSE_CURLY_BRACKET + UtilConstants.NEW_LINE;
+    }
+
+    /**
+     * Returns if condition for specific class object in equals method.
+     *
+     * @param className class name
+     * @return if condition string
+     */
+    private static String getEqualsMethodsSpecificIfCondition(String className) {
+        return UtilConstants.EIGHT_SPACE_INDENTATION + UtilConstants.IF + UtilConstants.SPACE
+                + UtilConstants.OPEN_PARENTHESIS + "obj" + UtilConstants.INSTANCE_OF + className
+                + UtilConstants.CLOSE_PARENTHESIS + UtilConstants.SPACE + UtilConstants.OPEN_CURLY_BRACKET
+                + UtilConstants.NEW_LINE + UtilConstants.TWELVE_SPACE_INDENTATION + className + UtilConstants.SPACE
+                + "other " + UtilConstants.EQUAL + UtilConstants.SPACE + UtilConstants.OPEN_PARENTHESIS + className
+                + UtilConstants.CLOSE_PARENTHESIS + UtilConstants.SPACE + "obj" + UtilConstants.SEMI_COLAN
+                + UtilConstants.NEW_LINE + UtilConstants.TWELVE_SPACE_INDENTATION + UtilConstants.RETURN
+                + UtilConstants.NEW_LINE;
+    }
+
+    /**
+     * Returns to equals methods close string.
+     *
+     * @param equalMethodString equal method string
+     * @return to equals method close string
+     */
+    public static String getEqualsMethodClose(String equalMethodString) {
+        equalMethodString = YangIoUtils.trimAtLast(equalMethodString, UtilConstants.AND);
+        equalMethodString = YangIoUtils.trimAtLast(equalMethodString, UtilConstants.AND);
+        equalMethodString = YangIoUtils.trimAtLast(equalMethodString, UtilConstants.SPACE);
+        equalMethodString = YangIoUtils.trimAtLast(equalMethodString, UtilConstants.NEW_LINE) + UtilConstants.SEMI_COLAN
+                + UtilConstants.NEW_LINE;
+        return equalMethodString + UtilConstants.EIGHT_SPACE_INDENTATION
+                + UtilConstants.CLOSE_CURLY_BRACKET + UtilConstants.NEW_LINE
+                + UtilConstants.EIGHT_SPACE_INDENTATION + UtilConstants.RETURN + UtilConstants.SPACE
+                + UtilConstants.FALSE + UtilConstants.SEMI_COLAN
+                + UtilConstants.NEW_LINE + UtilConstants.FOUR_SPACE_INDENTATION
+                + UtilConstants.CLOSE_CURLY_BRACKET;
+    }
+
+    /**
+     * Equals method for class.
+     *
+     * @param attr attribute info
+     * @return equals method
+     */
+    public static String getEqualsMethod(AttributeInfo attr) {
+        String attributeName = JavaIdentifierSyntax.getLowerCase(attr.getAttributeName());
+        return UtilConstants.SIXTEEN_SPACE_INDENTATION + UtilConstants.SPACE + UtilConstants.OBJECT_STRING + "s"
+                + UtilConstants.PERIOD + UtilConstants.EQUALS_STRING + UtilConstants.OPEN_PARENTHESIS + attributeName
+                + UtilConstants.COMMA + UtilConstants.SPACE + "other." + attributeName + UtilConstants.CLOSE_PARENTHESIS
+                + UtilConstants.SPACE + UtilConstants.AND + UtilConstants.AND;
+
+    }
+
+    /**
+     * Returns of method string for class.
+     *
+     * @param name class name
+     * @param attr attribute info
+     * @return of method string
+     */
+    public static String getOfMethod(String name, AttributeInfo attr) {
+
+        String attrQuaifiedType = "";
+        if (attr.isQualifiedName() && (attr.getImportInfo().getPkgInfo() != null)) {
+            attrQuaifiedType = attr.getImportInfo().getPkgInfo() + ".";
+        }
+        attrQuaifiedType = attrQuaifiedType + attr.getImportInfo().getClassInfo();
+
+        return UtilConstants.FOUR_SPACE_INDENTATION + UtilConstants.PUBLIC + UtilConstants.SPACE + UtilConstants.STATIC
+                + UtilConstants.SPACE + name + UtilConstants.SPACE + UtilConstants.OF + UtilConstants.OPEN_PARENTHESIS
+                + attrQuaifiedType + UtilConstants.SPACE + UtilConstants.VALUE + UtilConstants.CLOSE_PARENTHESIS
+                + UtilConstants.SPACE + UtilConstants.OPEN_CURLY_BRACKET + UtilConstants.NEW_LINE
+                + UtilConstants.EIGHT_SPACE_INDENTATION + UtilConstants.RETURN + UtilConstants.SPACE + UtilConstants.NEW
+                + UtilConstants.SPACE + name + UtilConstants.OPEN_PARENTHESIS + UtilConstants.VALUE
+                + UtilConstants.CLOSE_PARENTHESIS + UtilConstants.SEMI_COLAN + UtilConstants.NEW_LINE
+                + UtilConstants.FOUR_SPACE_INDENTATION + UtilConstants.CLOSE_CURLY_BRACKET + UtilConstants.NEW_LINE;
+    }
+
 }