[ONOS-3908] Implemetation of YANG container translator.

Change-Id: I9ffcfc4b370edb801dfc90c5394cef787c77641d
diff --git a/src/main/java/org/onosproject/yangutils/datamodel/YangAugment.java b/src/main/java/org/onosproject/yangutils/datamodel/YangAugment.java
index 073db3b..3f34922 100644
--- a/src/main/java/org/onosproject/yangutils/datamodel/YangAugment.java
+++ b/src/main/java/org/onosproject/yangutils/datamodel/YangAugment.java
@@ -21,6 +21,7 @@
 import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
 import org.onosproject.yangutils.parser.Parsable;
 import org.onosproject.yangutils.parser.ParsableDataType;
+import org.onosproject.yangutils.translator.CachedFileHandle;
 
 /*-
  * Reference RFC 6020.
@@ -342,4 +343,16 @@
         // TODO Auto-generated method stub
 
     }
+
+    @Override
+    public CachedFileHandle getFileHandle() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public void setFileHandle(CachedFileHandle fileHandle) {
+        // TODO Auto-generated method stub
+
+    }
 }
diff --git a/src/main/java/org/onosproject/yangutils/datamodel/YangCase.java b/src/main/java/org/onosproject/yangutils/datamodel/YangCase.java
index 76b8ca2..bcfa70c 100644
--- a/src/main/java/org/onosproject/yangutils/datamodel/YangCase.java
+++ b/src/main/java/org/onosproject/yangutils/datamodel/YangCase.java
@@ -21,6 +21,7 @@
 import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
 import org.onosproject.yangutils.parser.Parsable;
 import org.onosproject.yangutils.parser.ParsableDataType;
+import org.onosproject.yangutils.translator.CachedFileHandle;
 
 /*-
  * Reference RFC 6020.
@@ -336,4 +337,16 @@
         // TODO Auto-generated method stub
 
     }
+
+    @Override
+    public CachedFileHandle getFileHandle() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public void setFileHandle(CachedFileHandle fileHandle) {
+        // TODO Auto-generated method stub
+
+    }
 }
diff --git a/src/main/java/org/onosproject/yangutils/datamodel/YangChoice.java b/src/main/java/org/onosproject/yangutils/datamodel/YangChoice.java
index ed3d90a..be47039 100644
--- a/src/main/java/org/onosproject/yangutils/datamodel/YangChoice.java
+++ b/src/main/java/org/onosproject/yangutils/datamodel/YangChoice.java
@@ -21,6 +21,7 @@
 import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
 import org.onosproject.yangutils.parser.Parsable;
 import org.onosproject.yangutils.parser.ParsableDataType;
+import org.onosproject.yangutils.translator.CachedFileHandle;
 
 /*-
  * Reference RFC 6020.
@@ -252,6 +253,7 @@
      *
      * @return the description.
      */
+    @Override
     public String getDescription() {
         return description;
     }
@@ -261,6 +263,7 @@
      *
      * @param description set the description.
      */
+    @Override
     public void setDescription(String description) {
         this.description = description;
     }
@@ -270,6 +273,7 @@
      *
      * @return the reference.
      */
+    @Override
     public String getReference() {
         return reference;
     }
@@ -279,6 +283,7 @@
      *
      * @param reference the reference to set.
      */
+    @Override
     public void setReference(String reference) {
         this.reference = reference;
     }
@@ -288,6 +293,7 @@
      *
      * @return the status.
      */
+    @Override
     public YangStatusType getStatus() {
         return status;
     }
@@ -297,6 +303,7 @@
      *
      * @param status the status to set.
      */
+    @Override
     public void setStatus(YangStatusType status) {
         this.status = status;
     }
@@ -306,6 +313,7 @@
      *
      * @return returns CHOICE_DATA
      */
+    @Override
     public ParsableDataType getParsableDataType() {
         return ParsableDataType.CHOICE_DATA;
     }
@@ -315,6 +323,7 @@
      *
      * @throws DataModelException a violation of data model rules.
      */
+    @Override
     public void validateDataOnEntry() throws DataModelException {
         // TODO auto-generated method stub, to be implemented by parser
     }
@@ -324,6 +333,7 @@
      *
      * @throws DataModelException a violation of data model rules.
      */
+    @Override
     public void validateDataOnExit() throws DataModelException {
         // TODO auto-generated method stub, to be implemented by parser
     }
@@ -349,6 +359,7 @@
     /* (non-Javadoc)
      * @see org.onosproject.yangutils.translator.CodeGenerator#generateJavaCodeEntry()
      */
+    @Override
     public void generateJavaCodeEntry() {
         // TODO Auto-generated method stub
 
@@ -357,8 +368,21 @@
     /* (non-Javadoc)
      * @see org.onosproject.yangutils.translator.CodeGenerator#generateJavaCodeExit()
      */
+    @Override
     public void generateJavaCodeExit() {
         // TODO Auto-generated method stub
 
     }
+
+    @Override
+    public CachedFileHandle getFileHandle() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public void setFileHandle(CachedFileHandle fileHandle) {
+        // TODO Auto-generated method stub
+
+    }
 }
diff --git a/src/main/java/org/onosproject/yangutils/datamodel/YangContainer.java b/src/main/java/org/onosproject/yangutils/datamodel/YangContainer.java
index cb54cca..62a589a 100644
--- a/src/main/java/org/onosproject/yangutils/datamodel/YangContainer.java
+++ b/src/main/java/org/onosproject/yangutils/datamodel/YangContainer.java
@@ -133,7 +133,7 @@
     private YangStatusType status;
 
     /**
-     * package of the generated java code.
+     * Package of the generated java code.
      */
     private String pkg;
 
@@ -332,6 +332,7 @@
      *
      * @return the fileHandle
      */
+    @Override
     public CachedFileHandle getFileHandle() {
         return fileHandle;
     }
@@ -341,6 +342,7 @@
      *
      * @param handle the fileHandle to set
      */
+    @Override
     public void setFileHandle(CachedFileHandle handle) {
         fileHandle = handle;
     }
@@ -395,11 +397,6 @@
         pkg = pcg;
     }
 
-    /**
-     * Generate the java code corresponding to YANG container.
-     *
-     * @throws IOException when fails to generate the source files.
-     */
     @Override
     public void generateJavaCodeEntry() throws IOException {
         YangNode parent = getParent();
@@ -414,14 +411,33 @@
             throw new IOException("Failed to create the source files.");
         }
         setFileHandle(handle);
-        addLavesAttributes();
+        addAttributeInParent();
+    }
+
+    /**
+     * Adds current node attribute to parent file.
+     *
+     * @param pkg java file package path
+     */
+    private void addAttributeInParent() {
+        if (getParent() != null) {
+            getParent().getFileHandle().setChildsPackage(getPackage());
+            getParent().getFileHandle().addAttributeInfo(null, getName(), false);
+        }
+    }
+
+    @Override
+    public void generateJavaCodeExit() throws IOException {
+        addLeavesAttributes();
         addLeafListAttributes();
+        getFileHandle().close();
+        return;
     }
 
     /**
      * Adds leaf attributes in generated files.
      */
-    private void addLavesAttributes() {
+    private void addLeavesAttributes() {
 
         List<YangLeaf<?>> leaves = getListOfLeaf();
         if (leaves != null) {
@@ -442,17 +458,5 @@
             }
         }
         return;
-
-    }
-
-    /**
-     * Free resources used to generate code.
-     *
-     * @throws IOException when fails to generate source files.
-     */
-    @Override
-    public void generateJavaCodeExit() throws IOException {
-        getFileHandle().close();
-        return;
     }
 }
diff --git a/src/main/java/org/onosproject/yangutils/datamodel/YangEnumeration.java b/src/main/java/org/onosproject/yangutils/datamodel/YangEnumeration.java
index 2a05279..7aae900 100644
--- a/src/main/java/org/onosproject/yangutils/datamodel/YangEnumeration.java
+++ b/src/main/java/org/onosproject/yangutils/datamodel/YangEnumeration.java
@@ -22,6 +22,7 @@
 import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
 import org.onosproject.yangutils.parser.Parsable;
 import org.onosproject.yangutils.parser.ParsableDataType;
+import org.onosproject.yangutils.translator.CachedFileHandle;
 
 /*
  * The enumeration built-in type represents values from a set of
@@ -79,6 +80,7 @@
      *
      * @return returns ENUMERATION_DATA
      */
+    @Override
     public ParsableDataType getParsableDataType() {
         return ParsableDataType.ENUMERATION_DATA;
     }
@@ -88,6 +90,7 @@
      *
      * @throws DataModelException a violation of data model rules.
      */
+    @Override
     public void validateDataOnEntry() throws DataModelException {
         // TODO auto-generated method stub, to be implemented by parser
     }
@@ -97,6 +100,7 @@
      *
      * @throws DataModelException a violation of data model rules.
      */
+    @Override
     public void validateDataOnExit() throws DataModelException {
         // TODO auto-generated method stub, to be implemented by parser
     }
@@ -140,6 +144,7 @@
     /* (non-Javadoc)
      * @see org.onosproject.yangutils.translator.CodeGenerator#generateJavaCodeEntry()
      */
+    @Override
     public void generateJavaCodeEntry() {
         // TODO Auto-generated method stub
 
@@ -148,8 +153,21 @@
     /* (non-Javadoc)
      * @see org.onosproject.yangutils.translator.CodeGenerator#generateJavaCodeExit()
      */
+    @Override
     public void generateJavaCodeExit() {
         // TODO Auto-generated method stub
 
     }
+
+    @Override
+    public CachedFileHandle getFileHandle() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public void setFileHandle(CachedFileHandle fileHandle) {
+        // TODO Auto-generated method stub
+
+    }
 }
diff --git a/src/main/java/org/onosproject/yangutils/datamodel/YangGrouping.java b/src/main/java/org/onosproject/yangutils/datamodel/YangGrouping.java
index 27d7dc0..8dc0123 100644
--- a/src/main/java/org/onosproject/yangutils/datamodel/YangGrouping.java
+++ b/src/main/java/org/onosproject/yangutils/datamodel/YangGrouping.java
@@ -21,6 +21,7 @@
 import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
 import org.onosproject.yangutils.parser.Parsable;
 import org.onosproject.yangutils.parser.ParsableDataType;
+import org.onosproject.yangutils.translator.CachedFileHandle;
 
 /*-
  * Reference RFC 6020.
@@ -321,4 +322,16 @@
         // TODO Auto-generated method stub
 
     }
+
+    @Override
+    public CachedFileHandle getFileHandle() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public void setFileHandle(CachedFileHandle fileHandle) {
+        // TODO Auto-generated method stub
+
+    }
 }
diff --git a/src/main/java/org/onosproject/yangutils/datamodel/YangList.java b/src/main/java/org/onosproject/yangutils/datamodel/YangList.java
index e09b94c..577e160 100644
--- a/src/main/java/org/onosproject/yangutils/datamodel/YangList.java
+++ b/src/main/java/org/onosproject/yangutils/datamodel/YangList.java
@@ -22,6 +22,7 @@
 import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
 import org.onosproject.yangutils.parser.Parsable;
 import org.onosproject.yangutils.parser.ParsableDataType;
+import org.onosproject.yangutils.translator.CachedFileHandle;
 
 /*-
  *  The "list" statement is used to define an interior data node in the
@@ -459,4 +460,16 @@
         // TODO Auto-generated method stub
 
     }
+
+    @Override
+    public CachedFileHandle getFileHandle() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public void setFileHandle(CachedFileHandle fileHandle) {
+        // TODO Auto-generated method stub
+
+    }
 }
diff --git a/src/main/java/org/onosproject/yangutils/datamodel/YangModule.java b/src/main/java/org/onosproject/yangutils/datamodel/YangModule.java
index c35fafa..d1d3c7e 100644
--- a/src/main/java/org/onosproject/yangutils/datamodel/YangModule.java
+++ b/src/main/java/org/onosproject/yangutils/datamodel/YangModule.java
@@ -155,7 +155,7 @@
     private byte version;
 
     /**
-     * package of the generated java code.
+     * Package of the generated java code.
      */
     private String pkg;
 
@@ -493,6 +493,7 @@
      *
      * @return the fileHandle
      */
+    @Override
     public CachedFileHandle getFileHandle() {
         return fileHandle;
     }
@@ -502,6 +503,7 @@
      *
      * @param handle the fileHandle to set
      */
+    @Override
     public void setFileHandle(CachedFileHandle handle) {
         fileHandle = handle;
     }
@@ -555,14 +557,20 @@
             throw new IOException("Failed to create the source files.");
         }
         setFileHandle(handle);
-        addLavesAttributes();
+    }
+
+    @Override
+    public void generateJavaCodeExit() throws IOException {
+        addLeavesAttributes();
         addLeafListAttributes();
+        getFileHandle().close();
+        return;
     }
 
     /**
      * Adds leaf attributes in generated files.
      */
-    private void addLavesAttributes() {
+    private void addLeavesAttributes() {
 
         List<YangLeaf<?>> leaves = getListOfLeaf();
         if (leaves != null) {
@@ -584,15 +592,4 @@
         }
     }
 
-    /**
-     * Free resources used to generate code.
-     *
-     * @throws IOException when fails to generate source files.
-     */
-    @Override
-    public void generateJavaCodeExit() throws IOException {
-        getFileHandle().close();
-        return;
-    }
-
 }
diff --git a/src/main/java/org/onosproject/yangutils/datamodel/YangNode.java b/src/main/java/org/onosproject/yangutils/datamodel/YangNode.java
index 8c69bb6..0ac44d0 100644
--- a/src/main/java/org/onosproject/yangutils/datamodel/YangNode.java
+++ b/src/main/java/org/onosproject/yangutils/datamodel/YangNode.java
@@ -16,6 +16,7 @@
 package org.onosproject.yangutils.datamodel;
 
 import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
+import org.onosproject.yangutils.translator.CachedFileHandle;
 import org.onosproject.yangutils.translator.CodeGenerator;
 
 /**
@@ -253,4 +254,18 @@
      */
     public abstract void setPackage(String pkg);
 
+    /**
+     * Get the mapped java file handler.
+     *
+     * @return the file handle.
+     */
+    public abstract CachedFileHandle getFileHandle();
+
+    /**
+     * Set the mapped java file handle.
+     *
+     * @param fileHandle the file handle to set of current node.
+     */
+    public abstract void setFileHandle(CachedFileHandle fileHandle);
+
 }
diff --git a/src/main/java/org/onosproject/yangutils/datamodel/YangSubModule.java b/src/main/java/org/onosproject/yangutils/datamodel/YangSubModule.java
index 36dbb23..04b7cfb 100644
--- a/src/main/java/org/onosproject/yangutils/datamodel/YangSubModule.java
+++ b/src/main/java/org/onosproject/yangutils/datamodel/YangSubModule.java
@@ -21,6 +21,7 @@
 import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
 import org.onosproject.yangutils.parser.Parsable;
 import org.onosproject.yangutils.parser.ParsableDataType;
+import org.onosproject.yangutils.translator.CachedFileHandle;
 
 /*
  *  Reference RFC 6020.
@@ -491,4 +492,16 @@
         // TODO Auto-generated method stub
 
     }
+
+    @Override
+    public CachedFileHandle getFileHandle() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public void setFileHandle(CachedFileHandle fileHandle) {
+        // TODO Auto-generated method stub
+
+    }
 }
diff --git a/src/main/java/org/onosproject/yangutils/datamodel/YangTypeDef.java b/src/main/java/org/onosproject/yangutils/datamodel/YangTypeDef.java
index 57ef9dd..a1abb0d 100644
--- a/src/main/java/org/onosproject/yangutils/datamodel/YangTypeDef.java
+++ b/src/main/java/org/onosproject/yangutils/datamodel/YangTypeDef.java
@@ -18,6 +18,7 @@
 import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
 import org.onosproject.yangutils.parser.Parsable;
 import org.onosproject.yangutils.parser.ParsableDataType;
+import org.onosproject.yangutils.translator.CachedFileHandle;
 
 /*-
  * Reference RFC 6020.
@@ -138,6 +139,7 @@
      *
      * @return the description.
      */
+    @Override
     public String getDescription() {
         return description;
     }
@@ -147,6 +149,7 @@
      *
      * @param description set the description.
      */
+    @Override
     public void setDescription(String description) {
         this.description = description;
     }
@@ -156,6 +159,7 @@
      *
      * @return the reference.
      */
+    @Override
     public String getReference() {
         return reference;
     }
@@ -165,6 +169,7 @@
      *
      * @param reference the reference to set.
      */
+    @Override
     public void setReference(String reference) {
         this.reference = reference;
     }
@@ -174,6 +179,7 @@
      *
      * @return the status.
      */
+    @Override
     public YangStatusType getStatus() {
         return status;
     }
@@ -183,6 +189,7 @@
      *
      * @param status the status to set.
      */
+    @Override
     public void setStatus(YangStatusType status) {
         this.status = status;
     }
@@ -230,6 +237,7 @@
      *
      * @return returns TYPEDEF_DATA
      */
+    @Override
     public ParsableDataType getParsableDataType() {
         return ParsableDataType.TYPEDEF_DATA;
     }
@@ -239,6 +247,7 @@
      *
      * @throws DataModelException a violation of data model rules.
      */
+    @Override
     public void validateDataOnEntry() throws DataModelException {
         // TODO auto-generated method stub, to be implemented by parser
     }
@@ -248,6 +257,7 @@
      *
      * @throws DataModelException a violation of data model rules.
      */
+    @Override
     public void validateDataOnExit() throws DataModelException {
         // TODO auto-generated method stub, to be implemented by parser
     }
@@ -273,6 +283,7 @@
     /* (non-Javadoc)
      * @see org.onosproject.yangutils.translator.CodeGenerator#generateJavaCodeEntry()
      */
+    @Override
     public void generateJavaCodeEntry() {
         // TODO Auto-generated method stub
 
@@ -281,6 +292,7 @@
     /* (non-Javadoc)
      * @see org.onosproject.yangutils.translator.CodeGenerator#generateJavaCodeExit()
      */
+    @Override
     public void generateJavaCodeExit() {
         // TODO Auto-generated method stub
 
@@ -303,4 +315,16 @@
         // TODO Auto-generated method stub
 
     }
+
+    @Override
+    public CachedFileHandle getFileHandle() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public void setFileHandle(CachedFileHandle fileHandle) {
+        // TODO Auto-generated method stub
+
+    }
 }
diff --git a/src/main/java/org/onosproject/yangutils/datamodel/YangUses.java b/src/main/java/org/onosproject/yangutils/datamodel/YangUses.java
index 19fb709..5326764 100644
--- a/src/main/java/org/onosproject/yangutils/datamodel/YangUses.java
+++ b/src/main/java/org/onosproject/yangutils/datamodel/YangUses.java
@@ -18,6 +18,7 @@
 import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
 import org.onosproject.yangutils.parser.Parsable;
 import org.onosproject.yangutils.parser.ParsableDataType;
+import org.onosproject.yangutils.translator.CachedFileHandle;
 
 /*-
  * Reference RFC 6020.
@@ -127,6 +128,7 @@
      *
      * @return the description.
      */
+    @Override
     public String getDescription() {
         return description;
     }
@@ -136,6 +138,7 @@
      *
      * @param description set the description.
      */
+    @Override
     public void setDescription(String description) {
         this.description = description;
     }
@@ -145,6 +148,7 @@
      *
      * @return the reference.
      */
+    @Override
     public String getReference() {
         return reference;
     }
@@ -154,6 +158,7 @@
      *
      * @param reference the reference to set.
      */
+    @Override
     public void setReference(String reference) {
         this.reference = reference;
     }
@@ -163,6 +168,7 @@
      *
      * @return the status.
      */
+    @Override
     public YangStatusType getStatus() {
         return status;
     }
@@ -172,6 +178,7 @@
      *
      * @param status the status to set.
      */
+    @Override
     public void setStatus(YangStatusType status) {
         this.status = status;
     }
@@ -181,6 +188,7 @@
      *
      * @return returns USES_DATA.
      */
+    @Override
     public ParsableDataType getParsableDataType() {
         return ParsableDataType.USES_DATA;
     }
@@ -190,6 +198,7 @@
      *
      * @throws DataModelException a violation of data model rules.
      */
+    @Override
     public void validateDataOnEntry() throws DataModelException {
         // TODO auto-generated method stub, to be implemented by parser
     }
@@ -199,6 +208,7 @@
      *
      * @throws DataModelException a violation of data model rules.
      */
+    @Override
     public void validateDataOnExit() throws DataModelException {
         // TODO auto-generated method stub, to be implemented by parser
     }
@@ -224,6 +234,7 @@
     /* (non-Javadoc)
      * @see org.onosproject.yangutils.translator.CodeGenerator#generateJavaCodeEntry()
      */
+    @Override
     public void generateJavaCodeEntry() {
         // TODO Auto-generated method stub
 
@@ -232,6 +243,7 @@
     /* (non-Javadoc)
      * @see org.onosproject.yangutils.translator.CodeGenerator#generateJavaCodeExit()
      */
+    @Override
     public void generateJavaCodeExit() {
         // TODO Auto-generated method stub
 
@@ -254,4 +266,16 @@
         // TODO Auto-generated method stub
 
     }
+
+    @Override
+    public CachedFileHandle getFileHandle() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public void setFileHandle(CachedFileHandle fileHandle) {
+        // TODO Auto-generated method stub
+
+    }
 }
diff --git a/src/main/java/org/onosproject/yangutils/translator/CachedFileHandle.java b/src/main/java/org/onosproject/yangutils/translator/CachedFileHandle.java
index cd5fa81..b73b821 100644
--- a/src/main/java/org/onosproject/yangutils/translator/CachedFileHandle.java
+++ b/src/main/java/org/onosproject/yangutils/translator/CachedFileHandle.java
@@ -42,4 +42,11 @@
      * @throws IOException when failes to generated java files.
      */
     void close() throws IOException;
+
+    /**
+     * Sets child package path for import.
+     *
+     * @param pkg child's package path
+     */
+    void setChildsPackage(String pkg);
 }
diff --git a/src/main/java/org/onosproject/yangutils/translator/tojava/CachedJavaFileHandle.java b/src/main/java/org/onosproject/yangutils/translator/tojava/CachedJavaFileHandle.java
index 86656e9..ac917aa 100644
--- a/src/main/java/org/onosproject/yangutils/translator/tojava/CachedJavaFileHandle.java
+++ b/src/main/java/org/onosproject/yangutils/translator/tojava/CachedJavaFileHandle.java
@@ -18,6 +18,7 @@
 
 import java.io.File;
 import java.io.IOException;
+import java.util.ArrayList;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.SortedSet;
@@ -68,6 +69,11 @@
     private String pkg;
 
     /**
+     * Java package in which the child class/interface needs to be generated.
+     */
+    private String childsPkg;
+
+    /**
      * Name of the object in YANG file.
      */
     private String yangName;
@@ -76,7 +82,7 @@
      * Sorted set of import info, to be used to maintain the set of classes to
      * be imported in the generated class.
      */
-    private SortedSet<ImportInfo> importSet;
+    private SortedSet<String> importSet;
 
     /**
      * Cached list of attribute info.
@@ -171,11 +177,30 @@
     }
 
     /**
+     * Get the java package.
+     *
+     * @return the java package.
+     */
+    public String getChildsPackage() {
+        return childsPkg;
+    }
+
+    /**
+     * Set the java package.
+     *
+     * @param pcg the package to set
+     */
+    @Override
+    public void setChildsPackage(String pcg) {
+        childsPkg = pcg;
+    }
+
+    /**
      * Get the set containing the imported class/interface info.
      *
      * @return the set containing the imported class/interface info.
      */
-    public SortedSet<ImportInfo> getImportSet() {
+    public SortedSet<String> getImportSet() {
         return importSet;
     }
 
@@ -184,7 +209,7 @@
      *
      * @param importSet the set containing the imported class/interface info.
      */
-    private void setImportSet(SortedSet<ImportInfo> importSet) {
+    private void setImportSet(SortedSet<String> importSet) {
         this.importSet = importSet;
     }
 
@@ -203,9 +228,9 @@
          * be used in the generated class.
          */
         if (getImportSet() == null) {
-            setImportSet(new TreeSet<ImportInfo>());
+            setImportSet(new TreeSet<String>());
         }
-        return getImportSet().add(importInfo);
+        return getImportSet().add(JavaCodeSnippetGen.getImportText(importInfo));
     }
 
     /**
@@ -253,23 +278,42 @@
     public void addAttributeInfo(YangType<?> attrType, String name, boolean isListAttr) {
 
         AttributeInfo newAttr = new AttributeInfo();
-        attrType.setDataTypeName(attrType.getDataTypeName().replace("\"", ""));
-        if (attrType.getDataTypeName().equals("string")) {
-            attrType.setDataTypeName(
-                    attrType.getDataTypeName().substring(0, 1).toUpperCase() + attrType.getDataTypeName().substring(1));
+        if (attrType != null) {
+            attrType.setDataTypeName(attrType.getDataTypeName().replace("\"", ""));
+            if (attrType.getDataTypeName().equals("string")) {
+                attrType.setDataTypeName(JavaIdentifierSyntax.getCaptialCase(attrType.getDataTypeName()));
+            }
+            newAttr.setAttributeType(attrType);
+        } else {
+            ImportInfo importInfo = new ImportInfo();
+            importInfo.setPkgInfo(getChildsPackage());
+            importInfo.setClassInfo(JavaIdentifierSyntax.getCaptialCase(name));
+            if (getImportSet() != null) {
+                getImportSet().add(JavaCodeSnippetGen.getImportText(importInfo));
+            } else {
+                SortedSet<String> newImportInfo = new TreeSet<>();
+                newImportInfo.add(JavaCodeSnippetGen.getImportText(importInfo));
+                setImportSet(newImportInfo);
+            }
+
+            newAttr.setQualifiedName(getQualifiedFlag(JavaCodeSnippetGen.getImportText(importInfo)));
         }
-        newAttr.setAttributeType(attrType);
         newAttr.setAttributeName(name);
         newAttr.setListAttr(isListAttr);
 
-        /*
-         * TODO: get the prefix and name of data type from attrType and
-         * initialize in importInfo.
-         */
+        if (isListAttr) {
+            String listImport = UtilConstants.COLLECTION_IMPORTS + UtilConstants.LIST + UtilConstants.SEMI_COLAN
+                    + UtilConstants.NEW_LINE + UtilConstants.NEW_LINE;
+            if (getImportSet() != null) {
+                getImportSet().add(listImport);
+            } else {
+                SortedSet<String> newImportInfo = new TreeSet<>();
+                newImportInfo.add(listImport);
+                setImportSet(newImportInfo);
+            }
 
-        /**
-         * TODO: Handle QualifiedFlag for imports.
-         */
+            newAttr.setQualifiedName(getQualifiedFlag(listImport));
+        }
 
         if (getCachedAttributeList() != null) {
             if (getCachedAttributeList().size() == MAX_CACHABLE_ATTR) {
@@ -281,7 +325,32 @@
             newAttributeInfo.add(newAttr);
             setCachedAttributeList(newAttributeInfo);
         }
-        name = JavaIdentifierSyntax.getCamelCase(name);
+    }
+
+    /**
+     * Check if the import set does not have a class info same as the new class
+     * info, if so the new class info be added to the import set. Otherwise
+     * check if the corresponding package info is same as the new package info,
+     * if so no need to qualified access, otherwise, it needs qualified access.
+     *
+     * @param newImportInfo new import info to be check for qualified access or
+     *            not and updated in the import set accordingly.
+     * @return if the new attribute needs to be accessed in a qualified manner.
+     */
+    private boolean getQualifiedFlag(String newImportInfo) {
+        for (String curImportInfo : getImportSet()) {
+            if (curImportInfo.equals(newImportInfo)) {
+                /*
+                 * If import is already existing import with same package, we
+                 * don't need qualified access, otherwise it needs to be
+                 * qualified access.
+                 */
+                return !curImportInfo.equals(newImportInfo);
+            }
+        }
+
+        getImportSet().add(newImportInfo);
+        return false;
     }
 
     /**
@@ -291,7 +360,7 @@
     public void close() throws IOException {
 
         String className = getYangName();
-        className = (className.substring(0, 1).toUpperCase() + className.substring(1));
+        className = JavaIdentifierSyntax.getCaptialCase(className);
         String packagePath = getPackage();
         String filePath = UtilConstants.YANG_GEN_DIR + packagePath.replace(".", "/");
         GeneratedFileType fileType = getGeneratedFileTypes();
@@ -322,60 +391,18 @@
         String implFileName = className + UtilConstants.IMPL + TEMP_FILE_EXTENSION;
         File implTempFile = new File(filePath + File.separator + implFileName);
 
-        if (fileType.equals(GeneratedFileType.INTERFACE) || fileType.equals(GeneratedFileType.ALL)) {
-
-            try {
-                interfaceFile.createNewFile();
-                appendContents(interfaceFile, className, GeneratedFileType.INTERFACE);
-            } catch (IOException e) {
-                throw new IOException("Failed to create interface file.");
-            }
-        }
-
-        if (fileType.equals(GeneratedFileType.BUILDER_CLASS) || fileType.equals(GeneratedFileType.ALL)) {
-
-            try {
-                builderFile.createNewFile();
-                appendContents(builderFile, className, GeneratedFileType.BUILDER_CLASS);
-            } catch (IOException e) {
-                throw new IOException("Failed to create builder class file.");
-            }
-        }
-
-        if (fileType.equals(GeneratedFileType.IMPL) || fileType.equals(GeneratedFileType.ALL)) {
-
-            try {
-                implTempFile.createNewFile();
-                appendContents(implTempFile, className, GeneratedFileType.IMPL);
-            } catch (IOException e) {
-                throw new IOException("Failed to create impl class file.");
-            }
-        }
-
-        if (fileType.equals(GeneratedFileType.BUILDER_INTERFACE) || fileType.equals(GeneratedFileType.ALL)) {
-
-            try {
-                builderInterfaceFile.createNewFile();
-                appendContents(builderInterfaceFile, className, GeneratedFileType.BUILDER_INTERFACE);
-            } catch (IOException e) {
-                throw new IOException("Failed to create builder interface class file.");
-            }
-        }
         /*
          * TODO: add the file header using
          * JavaCodeSnippetGen.getFileHeaderComment
          */
-        /*
-         * TODO: get the import list using getImportText and add to the
-         * generated java file using JavaCodeSnippetGen.getImportText
-         */
 
         List<String> attributes = new LinkedList<>();
         List<String> interfaceMethods = new LinkedList<>();
         List<String> builderInterfaceMethods = new LinkedList<>();
         List<String> builderClassMethods = new LinkedList<>();
         List<String> implClassMethods = new LinkedList<>();
-        //TODO: Handle imports for the attributes.
+        List<String> imports = new LinkedList<>();
+
         try {
             attributes = SerializedDataStore.getSerializeData(SerializedDataStore.SerializedDataStoreType.ATTRIBUTE);
 
@@ -391,7 +418,7 @@
             implClassMethods = SerializedDataStore
                     .getSerializeData(SerializedDataStore.SerializedDataStoreType.IMPL_METHODS);
 
-            //TODO:imports = SerializedDataStore.getSerializeData(SerializedDataStore.SerializedDataStoreType.IMPORT);
+            imports = SerializedDataStore.getSerializeData(SerializedDataStore.SerializedDataStoreType.IMPORT);
         } catch (ClassNotFoundException | IOException e) {
             log.info("There is no attribute info of " + className + " YANG file in the serialized files.");
         }
@@ -399,6 +426,14 @@
         if (getCachedAttributeList() != null) {
             MethodsGenerator.setAttrInfo(getCachedAttributeList());
             for (AttributeInfo attr : getCachedAttributeList()) {
+                if (attr.isListAttr()) {
+                    String listString = JavaCodeSnippetGen.getListAttribute(attr.getAttributeType().getDataTypeName());
+                    @SuppressWarnings("rawtypes")
+                    YangType<?> type = new YangType();
+                    type.setDataTypeName(listString);
+                    attr.setAttributeType(type);
+                }
+
                 attributes.add(getAttributeString(attr));
 
                 interfaceMethods.add(MethodsGenerator.getMethodString(attr, GeneratedFileType.INTERFACE));
@@ -409,6 +444,10 @@
                 .add(MethodsGenerator.getMethodString(attr, GeneratedFileType.BUILDER_INTERFACE));
 
                 implClassMethods.add(MethodsGenerator.getMethodString(attr, GeneratedFileType.IMPL));
+
+                if (getImportSet() != null) {
+                    imports = new ArrayList<>(getImportSet());
+                }
             }
         }
 
@@ -422,6 +461,25 @@
         implClassMethods.add(MethodsGenerator.getConstructorString(className));
 
         /**
+         * Start generation of files.
+         */
+        if (fileType.equals(GeneratedFileType.INTERFACE) || fileType.equals(GeneratedFileType.ALL)) {
+            initiateFile(interfaceFile, className, GeneratedFileType.INTERFACE, imports);
+        }
+
+        if (fileType.equals(GeneratedFileType.BUILDER_CLASS) || fileType.equals(GeneratedFileType.ALL)) {
+            initiateFile(builderFile, className, GeneratedFileType.BUILDER_CLASS, imports);
+        }
+
+        if (fileType.equals(GeneratedFileType.IMPL) || fileType.equals(GeneratedFileType.ALL)) {
+            initiateFile(implTempFile, className, GeneratedFileType.IMPL, imports);
+        }
+
+        if (fileType.equals(GeneratedFileType.BUILDER_INTERFACE) || fileType.equals(GeneratedFileType.ALL)) {
+            initiateFile(builderInterfaceFile, className, GeneratedFileType.BUILDER_INTERFACE, imports);
+        }
+
+        /**
          * Add attributes to the file.
          */
         for (String attribute : attributes) {
@@ -483,6 +541,25 @@
     }
 
     /**
+     * Initiate generation of file based on generated file type.
+     *
+     * @param file generated file
+     * @param className generated file class name
+     * @param type generated file type
+     * @param imports imports for the file
+     * @throws IOException when fails to generate a file
+     */
+    private void initiateFile(File file, String className, GeneratedFileType type, List<String> imports)
+            throws IOException {
+        try {
+            file.createNewFile();
+            appendContents(file, className, type, imports);
+        } catch (IOException e) {
+            throw new IOException("Failed to create " + file.getName() + " class file.");
+        }
+    }
+
+    /**
      * Appends the temp files to main files.
      *
      * @param appendFile temp file
@@ -584,7 +661,8 @@
      * @param fileName generated file name
      * @param type generated file type
      */
-    private void appendContents(File file, String fileName, GeneratedFileType type) throws IOException {
+    private void appendContents(File file, String fileName, GeneratedFileType type, List<String> importsList)
+            throws IOException {
 
         if (type.equals(GeneratedFileType.IMPL)) {
 
@@ -599,12 +677,20 @@
             if (type.equals(GeneratedFileType.INTERFACE)) {
                 insert(file, CopyrightHeader.getCopyrightHeader());
                 insert(file, "package" + UtilConstants.SPACE + getPackage() + UtilConstants.SEMI_COLAN
-                        + UtilConstants.NEW_LINE);
+                        + UtilConstants.NEW_LINE + UtilConstants.NEW_LINE);
+                for (String imports : importsList) {
+                    insert(file, imports);
+                }
+                insert(file, UtilConstants.NEW_LINE);
                 write(file, fileName, type, JavaDocType.INTERFACE);
             } else if (type.equals(GeneratedFileType.BUILDER_CLASS)) {
                 insert(file, CopyrightHeader.getCopyrightHeader());
                 insert(file, "package" + UtilConstants.SPACE + getPackage() + UtilConstants.SEMI_COLAN
-                        + UtilConstants.NEW_LINE);
+                        + UtilConstants.NEW_LINE + UtilConstants.NEW_LINE);
+                for (String imports : importsList) {
+                    insert(file, imports);
+                }
+                insert(file, UtilConstants.NEW_LINE);
                 write(file, fileName, type, JavaDocType.BUILDER_CLASS);
             }
         }
diff --git a/src/main/java/org/onosproject/yangutils/translator/tojava/JavaCodeGenerator.java b/src/main/java/org/onosproject/yangutils/translator/tojava/JavaCodeGenerator.java
index 000ab8b..50b0d06 100644
--- a/src/main/java/org/onosproject/yangutils/translator/tojava/JavaCodeGenerator.java
+++ b/src/main/java/org/onosproject/yangutils/translator/tojava/JavaCodeGenerator.java
@@ -42,18 +42,19 @@
         TraversalType curTraversal = TraversalType.ROOT;
 
         while (!(curNode == null)) {
-            if (curTraversal != TraversalType.PARENT) {
+            if (curTraversal != TraversalType.PARENT || curTraversal == TraversalType.SIBILING) {
                 curNode.generateJavaCodeEntry();
             }
             if (curTraversal != TraversalType.PARENT && !(curNode.getChild() == null)) {
                 curTraversal = TraversalType.CHILD;
                 curNode = curNode.getChild();
-            } else if (!(curNode.getNextSibling() == null)) {
+            } else if (curTraversal == TraversalType.PARENT && !(curNode.getNextSibling() == null)) {
+                curNode.generateJavaCodeExit();
                 curTraversal = TraversalType.SIBILING;
                 curNode = curNode.getNextSibling();
             } else {
-                curTraversal = TraversalType.PARENT;
                 curNode.generateJavaCodeExit();
+                curTraversal = TraversalType.PARENT;
                 curNode = curNode.getParent();
             }
         }
diff --git a/src/main/java/org/onosproject/yangutils/translator/tojava/utils/JavaCodeSnippetGen.java b/src/main/java/org/onosproject/yangutils/translator/tojava/utils/JavaCodeSnippetGen.java
index 5998342..e8bade3 100644
--- a/src/main/java/org/onosproject/yangutils/translator/tojava/utils/JavaCodeSnippetGen.java
+++ b/src/main/java/org/onosproject/yangutils/translator/tojava/utils/JavaCodeSnippetGen.java
@@ -16,9 +16,6 @@
 
 package org.onosproject.yangutils.translator.tojava.utils;
 
-import java.util.List;
-import java.util.SortedSet;
-
 import org.onosproject.yangutils.datamodel.YangType;
 import org.onosproject.yangutils.translator.GeneratedFileType;
 import org.onosproject.yangutils.translator.tojava.GeneratedMethodTypes;
@@ -50,29 +47,15 @@
     }
 
     /**
-     * reorder the import list based on the ONOS import rules.
-     *
-     * @param importInfo the set of classes/interfaces to be imported.
-     * @return string of import info.
-     */
-    public List<ImportInfo> sortImportOrder(SortedSet<ImportInfo> importInfo) {
-        /* TODO: reorder the import list based on the ONOS import rules. */
-        return null;
-    }
-
-    /**
      * Get the textual java code information corresponding to the import list.
      *
-     * @param importInfo sorted list of import info.
+     * @param importInfo import info.
      * @return the textual java code information corresponding to the import
      *         list.
      */
-    public static String getImportText(List<ImportInfo> importInfo) {
-        /*
-         * TODO: get the textual java code information corresponding to the
-         * import list
-         */
-        return null;
+    public static String getImportText(ImportInfo importInfo) {
+        return UtilConstants.IMPORT + importInfo.getPkgInfo() + UtilConstants.PERIOD + importInfo.getClassInfo()
+        + UtilConstants.SEMI_COLAN + UtilConstants.NEW_LINE;
     }
 
     /**
@@ -101,8 +84,22 @@
      */
     public static String getJavaAttributeInfo(GeneratedFileType genFileTypes, String yangName, YangType<?> type) {
         yangName = JavaIdentifierSyntax.getCamelCase(yangName);
-        return UtilConstants.PRIVATE + UtilConstants.SPACE + type.getDataTypeName() + UtilConstants.SPACE + yangName
-                + UtilConstants.SEMI_COLAN;
+        if (type != null) {
+            return UtilConstants.PRIVATE + UtilConstants.SPACE + type.getDataTypeName() + UtilConstants.SPACE + yangName
+                    + UtilConstants.SEMI_COLAN;
+        }
+        return UtilConstants.PRIVATE + UtilConstants.SPACE + JavaIdentifierSyntax.getCaptialCase(yangName)
+        + UtilConstants.SPACE + yangName + UtilConstants.SEMI_COLAN;
+    }
+
+    /**
+     * Returns list attribute string.
+     *
+     * @param type attribute type
+     * @return list attribute string
+     */
+    public static String getListAttribute(String type) {
+        return UtilConstants.LIST + UtilConstants.DIAMOND_OPEN_BRACKET + type + UtilConstants.DIAMOND_CLOSE_BRACKET;
     }
 
     /**
diff --git a/src/main/java/org/onosproject/yangutils/translator/tojava/utils/JavaIdentifierSyntax.java b/src/main/java/org/onosproject/yangutils/translator/tojava/utils/JavaIdentifierSyntax.java
index 94bcfeb..cd26056 100644
--- a/src/main/java/org/onosproject/yangutils/translator/tojava/utils/JavaIdentifierSyntax.java
+++ b/src/main/java/org/onosproject/yangutils/translator/tojava/utils/JavaIdentifierSyntax.java
@@ -163,4 +163,14 @@
         }
         return camelCase;
     }
+
+    /**
+     * Translate the YANG identifier name to java identifier with first letter in caps.
+     *
+     * @param yangIdentifier identifier in YANG file.
+     * @return corresponding java identifier
+     */
+    public static String getCaptialCase(String yangIdentifier) {
+        return yangIdentifier.substring(0, 1).toUpperCase() + yangIdentifier.substring(1);
+    }
 }
diff --git a/src/main/java/org/onosproject/yangutils/translator/tojava/utils/MethodsGenerator.java b/src/main/java/org/onosproject/yangutils/translator/tojava/utils/MethodsGenerator.java
index 604caf6..2092441 100644
--- a/src/main/java/org/onosproject/yangutils/translator/tojava/utils/MethodsGenerator.java
+++ b/src/main/java/org/onosproject/yangutils/translator/tojava/utils/MethodsGenerator.java
@@ -112,6 +112,13 @@
     public static String constructMethodInfo(GeneratedFileType genFileTypes, String yangName,
             GeneratedMethodTypes methodTypes, YangType<?> returnType) {
 
+        if (returnType == null) {
+            @SuppressWarnings("rawtypes")
+            YangType<?> type = new YangType();
+            type.setDataTypeName(yangName);
+            returnType = type;
+        }
+
         if (genFileTypes.equals(GeneratedFileType.INTERFACE)) {
 
             /**
@@ -177,12 +184,10 @@
 
         String overrideString = UtilConstants.NEW_LINE + UtilConstants.FOUR_SPACE_INDENTATION + UtilConstants.OVERRIDE
                 + UtilConstants.NEW_LINE;
-
         String getterString = JavaCodeSnippetGen.getJavaMethodInfo(GeneratedFileType.BUILDER_CLASS,
                 attr.getAttributeName(), GeneratedMethodTypes.GETTER, attr.getAttributeType());
         String setterString = JavaCodeSnippetGen.getJavaMethodInfo(GeneratedFileType.BUILDER_CLASS,
                 attr.getAttributeName(), GeneratedMethodTypes.SETTER, attr.getAttributeType());
-
         return overrideString + getterString + UtilConstants.NEW_LINE + overrideString + setterString
                 + UtilConstants.NEW_LINE;
     }
@@ -299,7 +304,8 @@
     private static String getGetterForClass(String yangName, YangType<?> returnType) {
 
         return UtilConstants.FOUR_SPACE_INDENTATION + UtilConstants.PUBLIC + UtilConstants.SPACE
-                + returnType.getDataTypeName() + UtilConstants.SPACE + UtilConstants.GET_METHOD_PREFIX + yangName
+                + JavaIdentifierSyntax.getCaptialCase(returnType.getDataTypeName()) + UtilConstants.SPACE
+                + UtilConstants.GET_METHOD_PREFIX + JavaIdentifierSyntax.getCaptialCase(yangName)
                 + UtilConstants.OPEN_PARENTHESIS + UtilConstants.CLOSE_PARENTHESIS + UtilConstants.SPACE
                 + UtilConstants.OPEN_CURLY_BRACKET + UtilConstants.NEW_LINE + UtilConstants.EIGHT_SPACE_INDENTATION
                 + UtilConstants.RETURN + UtilConstants.SPACE + yangName + UtilConstants.SEMI_COLAN
@@ -316,13 +322,14 @@
     private static String getSetterForClass(String yangName, YangType<?> returnType) {
 
         return UtilConstants.FOUR_SPACE_INDENTATION + UtilConstants.PUBLIC + UtilConstants.SPACE + getBuilderClassName()
-        + UtilConstants.SPACE + UtilConstants.SET_METHOD_PREFIX + yangName + UtilConstants.OPEN_PARENTHESIS
-        + returnType.getDataTypeName() + UtilConstants.SPACE + yangName + UtilConstants.CLOSE_PARENTHESIS
-        + UtilConstants.SPACE + UtilConstants.OPEN_CURLY_BRACKET + UtilConstants.NEW_LINE
-        + UtilConstants.EIGHT_SPACE_INDENTATION + UtilConstants.THIS + UtilConstants.PERIOD + yangName
-        + UtilConstants.SPACE + UtilConstants.EQUAL + UtilConstants.SPACE + yangName + UtilConstants.SEMI_COLAN
-        + UtilConstants.NEW_LINE + UtilConstants.EIGHT_SPACE_INDENTATION + UtilConstants.RETURN
-        + UtilConstants.SPACE + UtilConstants.THIS + UtilConstants.SEMI_COLAN + UtilConstants.NEW_LINE
+        + UtilConstants.SPACE + UtilConstants.SET_METHOD_PREFIX + JavaIdentifierSyntax.getCaptialCase(yangName)
+        + UtilConstants.OPEN_PARENTHESIS + JavaIdentifierSyntax.getCaptialCase(returnType.getDataTypeName())
+        + UtilConstants.SPACE + yangName + UtilConstants.CLOSE_PARENTHESIS + UtilConstants.SPACE
+        + UtilConstants.OPEN_CURLY_BRACKET + UtilConstants.NEW_LINE + UtilConstants.EIGHT_SPACE_INDENTATION
+        + UtilConstants.THIS + UtilConstants.PERIOD + yangName + UtilConstants.SPACE + UtilConstants.EQUAL
+        + UtilConstants.SPACE + yangName + 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;
     }
 
@@ -335,9 +342,9 @@
      */
     private static String getGetterForInterface(String yangName, YangType<?> returnType) {
         returnType.setDataTypeName(returnType.getDataTypeName().replace("\"", ""));
-        return UtilConstants.FOUR_SPACE_INDENTATION + returnType.getDataTypeName() + UtilConstants.SPACE
-                + UtilConstants.GET_METHOD_PREFIX + yangName + UtilConstants.OPEN_PARENTHESIS
-                + UtilConstants.CLOSE_PARENTHESIS + UtilConstants.SEMI_COLAN;
+        return UtilConstants.FOUR_SPACE_INDENTATION + JavaIdentifierSyntax.getCaptialCase(returnType.getDataTypeName())
+        + UtilConstants.SPACE + UtilConstants.GET_METHOD_PREFIX + JavaIdentifierSyntax.getCaptialCase(yangName)
+        + UtilConstants.OPEN_PARENTHESIS + UtilConstants.CLOSE_PARENTHESIS + UtilConstants.SEMI_COLAN;
     }
 
     /**
@@ -349,9 +356,9 @@
      */
     private static String getSetterForInterface(String yangName, YangType<?> returnType) {
         return UtilConstants.FOUR_SPACE_INDENTATION + UtilConstants.BUILDER + UtilConstants.SPACE
-                + UtilConstants.SET_METHOD_PREFIX + yangName + UtilConstants.OPEN_PARENTHESIS
-                + returnType.getDataTypeName() + UtilConstants.SPACE + yangName + UtilConstants.CLOSE_PARENTHESIS
-                + UtilConstants.SEMI_COLAN;
+                + UtilConstants.SET_METHOD_PREFIX + JavaIdentifierSyntax.getCaptialCase(yangName)
+                + UtilConstants.OPEN_PARENTHESIS + JavaIdentifierSyntax.getCaptialCase(returnType.getDataTypeName())
+                + UtilConstants.SPACE + yangName + UtilConstants.CLOSE_PARENTHESIS + UtilConstants.SEMI_COLAN;
     }
 
     /**
@@ -387,7 +394,8 @@
                 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 + attribute.getAttributeName()
+                        + UtilConstants.PERIOD + UtilConstants.GET_METHOD_PREFIX
+                        + JavaIdentifierSyntax.getCaptialCase(attribute.getAttributeName())
                         + UtilConstants.OPEN_PARENTHESIS + UtilConstants.CLOSE_PARENTHESIS + UtilConstants.SEMI_COLAN
                         + UtilConstants.NEW_LINE;
             }
diff --git a/src/main/java/org/onosproject/yangutils/utils/UtilConstants.java b/src/main/java/org/onosproject/yangutils/utils/UtilConstants.java
index 336b87e..637d2f4 100644
--- a/src/main/java/org/onosproject/yangutils/utils/UtilConstants.java
+++ b/src/main/java/org/onosproject/yangutils/utils/UtilConstants.java
@@ -129,7 +129,7 @@
     public static final String STATIC = "static";
     public static final String FINAL = "final";
     public static final String PACKAGE = "package";
-    public static final String IMPORT = "import";
+    public static final String IMPORT = "import ";
     public static final String NULL = "null";
     public static final String RETURN = "return";
     public static final String NEW = "new";
@@ -144,6 +144,7 @@
     /**
      * For collections.
      */
+    public static final String COLLECTION_IMPORTS = "import java.util.";
     public static final String ABSTRACT_COLLECTION = "AbstractCollection";
 
     public static final String LIST = "List";
diff --git a/src/main/java/org/onosproject/yangutils/utils/io/impl/FileSystemUtil.java b/src/main/java/org/onosproject/yangutils/utils/io/impl/FileSystemUtil.java
index f7e3556..cc4fa9d 100644
--- a/src/main/java/org/onosproject/yangutils/utils/io/impl/FileSystemUtil.java
+++ b/src/main/java/org/onosproject/yangutils/utils/io/impl/FileSystemUtil.java
@@ -62,8 +62,7 @@
     public static void createPackage(String pkg, String pkgInfo) throws IOException {
         if (!doesPackageExist(new File(pkg))) {
             try {
-                File pack = YangIoUtils
-                        .createDirectories(pkg.replace(UtilConstants.PERIOD, UtilConstants.SLASH));
+                File pack = YangIoUtils.createDirectories(pkg.replace(UtilConstants.PERIOD, UtilConstants.SLASH));
                 YangIoUtils.addPackageInfo(pack, pkgInfo, pkg);
             } catch (IOException e) {
                 throw new IOException("failed to create package-info file");
diff --git a/src/main/java/org/onosproject/yangutils/utils/io/impl/JavaDocGen.java b/src/main/java/org/onosproject/yangutils/utils/io/impl/JavaDocGen.java
index 635acf1..826eb7b 100644
--- a/src/main/java/org/onosproject/yangutils/utils/io/impl/JavaDocGen.java
+++ b/src/main/java/org/onosproject/yangutils/utils/io/impl/JavaDocGen.java
@@ -226,8 +226,8 @@
      */
     private static String generateForConstructors(String className) {
         return (UtilConstants.JAVA_DOC_FIRST_LINE + UtilConstants.FOUR_SPACE_INDENTATION
-                + UtilConstants.JAVA_DOC_SETTERS + className + UtilConstants.PERIOD + UtilConstants.NEW_LINE
-                + UtilConstants.FOUR_SPACE_INDENTATION + UtilConstants.NEW_LINE_ESTRIC
+                + UtilConstants.JAVA_DOC_CONSTRUCTOR + className + UtilConstants.IMPL + UtilConstants.PERIOD
+                + UtilConstants.NEW_LINE + UtilConstants.FOUR_SPACE_INDENTATION + UtilConstants.NEW_LINE_ESTRIC
                 + UtilConstants.FOUR_SPACE_INDENTATION + UtilConstants.JAVA_DOC_PARAM
                 + (className.substring(0, 1).toLowerCase() + className.substring(1)) + UtilConstants.OBJECT
                 + UtilConstants.SPACE + UtilConstants.BUILDER_OBJECT + UtilConstants.SPACE + className
diff --git a/src/main/java/org/onosproject/yangutils/utils/io/impl/SerializedDataStore.java b/src/main/java/org/onosproject/yangutils/utils/io/impl/SerializedDataStore.java
index d33e1fe..d9d3732 100644
--- a/src/main/java/org/onosproject/yangutils/utils/io/impl/SerializedDataStore.java
+++ b/src/main/java/org/onosproject/yangutils/utils/io/impl/SerializedDataStore.java
@@ -27,6 +27,7 @@
 import java.io.ObjectOutput;
 import java.io.ObjectOutputStream;
 import java.io.OutputStream;
+import java.util.ArrayList;
 import java.util.List;
 
 /**
@@ -165,7 +166,6 @@
      * @throws IOException when fails to read from the file.
      * @throws ClassNotFoundException when file is missing.
      */
-    @SuppressWarnings("unchecked")
     public static List<String> getSerializeData(SerializedDataStoreType type)
             throws IOException, ClassNotFoundException {
 
@@ -191,10 +191,13 @@
             InputStream buffer = new BufferedInputStream(file);
             ObjectInput input = new ObjectInputStream(buffer);
             try {
-                List<String> recoveredData = (List<String>) input.readObject();
+                String data = (String) input.readObject();
+                List<String> recoveredData = new ArrayList<>();
+                recoveredData.add(data);
                 return recoveredData;
             } finally {
                 input.close();
+                file.close();
             }
         } catch (ClassNotFoundException ex) {
             throw new ClassNotFoundException("failed to fetch the serialized data file.");
diff --git a/src/main/java/org/onosproject/yangutils/utils/io/impl/YangIoUtils.java b/src/main/java/org/onosproject/yangutils/utils/io/impl/YangIoUtils.java
index af83de4..7f394db 100644
--- a/src/main/java/org/onosproject/yangutils/utils/io/impl/YangIoUtils.java
+++ b/src/main/java/org/onosproject/yangutils/utils/io/impl/YangIoUtils.java
@@ -27,6 +27,7 @@
 import org.apache.maven.model.Resource;
 
 import org.onosproject.yangutils.utils.UtilConstants;
+import org.apache.commons.io.FileUtils;
 
 import static org.slf4j.LoggerFactory.getLogger;
 import org.slf4j.Logger;
@@ -102,10 +103,10 @@
                     File currentFile = new File(file);
                     currentFile.delete();
                 }
+                FileUtils.deleteDirectory(generatedDirectory);
             } catch (IOException e) {
                 log.info("Failed to delete the generated files in " + generatedDirectory + " directory");
             }
-            generatedDirectory.delete();
         }
     }