commit e48f57d1c8e76edd12bbf0af018e4d6ff158473d
Author: @havlijan17 <havlijan@students.zcu.cz>
Date:   Thu Apr 16 17:58:39 2020 +0200

    #re#7832 Parent classes values OK
    Parent class field names OK, indetation not so yet

diff --git a/project/Deserializer/bcha.json b/project/Deserializer/bcha.json
index 86cf9cf..edd595f 100644
--- a/project/Deserializer/bcha.json
+++ b/project/Deserializer/bcha.json
@@ -1,15 +1,12 @@
 {
-	class samples.ok.Simple : {
-		"testDouble" : 1.0, 
-		"testInt" : 123, 
-		"intArray" : [ 5, 10, 15 ], 
-		"locInnerClassInstance" : {
-			class samples.ok.Inner : {
-				"vnitrni" : "INNER STRING AM I"
-			}
-		}, 
-		"localEnum" : LOW, 
-		"pozdrav" : "AHOJ", 
-		"stringArray" : [ "A", "B", "C" ]
-	}
+	class samples.ok.SimpleChild extends samples.ok.Simple : {
+		"navic" : "AHOJ, jsem tu navic"
+	},
+{
+		class samples.ok.Simple : {
+			"testDouble" : 1.0, 
+			"testInt" : 123, 
+			"pozdrav" : "AHOJ"
+		}	
+}
 }
\ No newline at end of file
diff --git a/project/Deserializer/src/Converter.java b/project/Deserializer/src/Converter.java
index 71fce7a..99818a2 100644
--- a/project/Deserializer/src/Converter.java
+++ b/project/Deserializer/src/Converter.java
@@ -72,7 +72,7 @@ public class Converter extends Thread {
 					//replace VS parametr
 					//Pustit 2X s parametrem nenabori vnitrni data (kde muzou byt html znacky)
 					//Ciste HTML / Cisty JSON
-					json += cnt.toJson("");
+					json += cnt.toJson("", null);
 				}
 			}
 
diff --git a/project/Deserializer/src/Deserializer.java b/project/Deserializer/src/Deserializer.java
index 2486e85..233da37 100644
--- a/project/Deserializer/src/Deserializer.java
+++ b/project/Deserializer/src/Deserializer.java
@@ -42,7 +42,7 @@ public class Deserializer extends Application {
 		stage.show();
 		
 		//tests
-		Converter thread = new Converter(this, new File("Deserializer/simple.out"), new File("Deserializer/bcha.json"));
+		Converter thread = new Converter(this, new File("Deserializer/simpleChild.out"), new File("Deserializer/bcha.json"));
 		thread.start();
 	}
 	
diff --git a/project/Deserializer/src/jdeserialize/arrayobj.java b/project/Deserializer/src/jdeserialize/arrayobj.java
index ca15b0d..e553ac5 100644
--- a/project/Deserializer/src/jdeserialize/arrayobj.java
+++ b/project/Deserializer/src/jdeserialize/arrayobj.java
@@ -1,5 +1,7 @@
 package jdeserialize;
 
+import java.util.Map;
+
 /**
  * <p>
  * Represents an array instance, including the values the comprise the array.
@@ -30,18 +32,18 @@ public class arrayobj extends contentbase {
         this.data = data;
     }
 
-    public @Override String toJson(String indentation) {
+    public @Override String toJson(String indentation, Map<classdesc, Map<field, Object>> fielddata) {
         StringBuilder sb = new StringBuilder();
         sb.append("[ ");
 
         for (Object el : this.data) {
             if (el != null) {
                 if (el instanceof content) {
-                    sb.append(((content) el).toJson(indentation));
+                    sb.append(((content) el).toJson(indentation, fielddata));
                 }else{
                     sb.append(el.toString());
                 }
-                // el null!
+                
                 if (!el.equals(this.data.get(this.data.size() - 1))) {
                     sb.append(", ");
                 }
diff --git a/project/Deserializer/src/jdeserialize/classdesc.java b/project/Deserializer/src/jdeserialize/classdesc.java
index 79aa549..4a38453 100644
--- a/project/Deserializer/src/jdeserialize/classdesc.java
+++ b/project/Deserializer/src/jdeserialize/classdesc.java
@@ -223,5 +223,69 @@ public class classdesc extends contentbase {
             }
         }
     }
+
+    public @Override String toJson(String indentation, Map<classdesc, Map<field, Object>> fielddata)
+    {
+        StringBuffer sb = new StringBuffer();
+        String val = "";
+        
+        indentation += "\t";
+
+        // ClassName
+        sb.append("{\n").append(indentation).append("class ").append(this.name);
+        // extends
+        if (this.superclass != null) {
+            sb.append(" extends ").append(this.superclass.name);
+        }
+        // implements
+        if (this.interfaces != null) {
+            sb.append(" implements ");
+            for (String str : this.interfaces) {
+                sb.append(str);
+            }
+        }
+        sb.append(" : {"); // ending of first line
+        
+        indentation += "\t";
+
+        for (field f : this.fields) {
+            // v this.fielddata najit element, jehoz key == classdesc
+            // v tomto prvku fielddata najdu value (element) podle key == f
+            // jeho value je chtena hodnota
+            var locVal = fielddata.get(this).get(f);
+
+            if(locVal instanceof content)
+            {
+                val = ((content)locVal).toJson(indentation, fielddata);
+            }
+            else {
+                val = locVal.toString();
+            }
+
+            sb.append("\n").append(indentation);
+            sb.append("\"").append(f.name).append("\"");
+            sb.append(" : ");
+            sb.append(val);
+
+            if (!f.equals(this.fields[this.fields.length - 1])) {
+                sb.append(", ");
+            }
+        }
+        indentation = indentation.substring(0, indentation.length() - 1);
+
+        sb.append("\n").append(indentation).append("}");
+        
+
+        if(this.superclass != null)
+        {
+            sb.append(",\n");
+            sb.append(this.superclass.toJson(indentation, fielddata));
+        }
+        
+        indentation = indentation.substring(0, indentation.length() - 1);
+        sb.append(indentation).append("\n}");
+
+        return sb.toString();
+    }
 }
 
diff --git a/project/Deserializer/src/jdeserialize/content.java b/project/Deserializer/src/jdeserialize/content.java
index be81bb0..2c06750 100644
--- a/project/Deserializer/src/jdeserialize/content.java
+++ b/project/Deserializer/src/jdeserialize/content.java
@@ -1,14 +1,17 @@
 package jdeserialize;
 
+import java.util.Map;
+
 /**
  * <p>
- * Generic interface for all data that may be read from the stream (except null).  
+ * Generic interface for all data that may be read from the stream (except
+ * null).
  * </p>
  *
  * <p>
- * A successful read of the stream will result in a series of content instances or null
- * references.  For details on specific metadata, see documentation on implementing
- * classes/subinterfaces.
+ * A successful read of the stream will result in a series of content instances
+ * or null references. For details on specific metadata, see documentation on
+ * implementing classes/subinterfaces.
  * </p>
  */
 public interface content {
@@ -65,6 +68,6 @@ public interface content {
      */
     public void setIsExceptionObject(boolean value);
 
-    public String toJson(String indentation);
+    public String toJson(String indentation, Map<classdesc, Map<field, Object>> fielddata);
 }
 
diff --git a/project/Deserializer/src/jdeserialize/contentbase.java b/project/Deserializer/src/jdeserialize/contentbase.java
index 2eb7bfb..dee4908 100644
--- a/project/Deserializer/src/jdeserialize/contentbase.java
+++ b/project/Deserializer/src/jdeserialize/contentbase.java
@@ -1,5 +1,7 @@
 package jdeserialize;
 
+import java.util.Map;
+
 /**
  * Provides a skeleton content implementation.
  */
@@ -25,7 +27,7 @@ public class contentbase implements content {
     public void validate() throws ValidityException {
     }
 
-    public @Override String toJson(String indetation)
+    public @Override String toJson(String indetation, Map<classdesc, Map<field, Object>> fielddata)
     {
         return this.toString();
     }
diff --git a/project/Deserializer/src/jdeserialize/enumobj.java b/project/Deserializer/src/jdeserialize/enumobj.java
index 89d6173..09e26ce 100644
--- a/project/Deserializer/src/jdeserialize/enumobj.java
+++ b/project/Deserializer/src/jdeserialize/enumobj.java
@@ -1,10 +1,13 @@
 package jdeserialize;
 
+import java.util.Map;
+
 /**
  * <p>
- * Represents an enum instance.  As noted in the serialization spec, this consists of
- * merely the class description (represented by a classdesc) and the string corresponding
- * to the enum's value.  No other fields are ever serialized.
+ * Represents an enum instance. As noted in the serialization spec, this
+ * consists of merely the class description (represented by a classdesc) and the
+ * string corresponding to the enum's value. No other fields are ever
+ * serialized.
  * </p>
  */
 public class enumobj extends contentbase {
@@ -31,7 +34,7 @@ public class enumobj extends contentbase {
         this.classdesc = cd;
         this.value = so;
     }
-    public @Override String toJson(String indetation) {
+    public @Override String toJson(String indetation, Map<classdesc, Map<field, Object>> fielddata) {
         return this.value.value;
     }
 
diff --git a/project/Deserializer/src/jdeserialize/instance.java b/project/Deserializer/src/jdeserialize/instance.java
index 5b828ac..11ddf14 100644
--- a/project/Deserializer/src/jdeserialize/instance.java
+++ b/project/Deserializer/src/jdeserialize/instance.java
@@ -26,24 +26,18 @@ public class instance extends contentbase {
         this.fielddata = new HashMap<classdesc, Map<field, Object>>();
     }
 
-    public @Override String toJson(String indentation)
+    public @Override String toJson(String indentation, Map<classdesc, Map<field, Object>> fielddata)
     {
         StringBuffer sb = new StringBuffer();
         String val = "";
         
         indentation += "\t";
 
-        /*if (classdesc.getType() == contenttype.CLASSDESC && !instance.indentedClasses.contains(classdesc.name)) {*/
-           /* instance.indentedClasses.add(classdesc.name);
-        }*/
-
         // ClassName
         sb.append("{\n").append(indentation).append("class ").append(classdesc.name);
-        //System.out.println(sb.toString());
         // extends
         if (classdesc.superclass != null) {
             sb.append(" extends ").append(classdesc.superclass.name);
-            //System.out.println(sb.toString());
         }
         // implements
         if (classdesc.interfaces != null) {
@@ -51,23 +45,20 @@ public class instance extends contentbase {
             for (String str : classdesc.interfaces) {
                 sb.append(str);
             }
-            //System.out.println(sb.toString());
         }
         sb.append(" : {"); // ending of first line
         
         indentation += "\t";
-        //System.out.println(sb.toString());
 
         for (field f : classdesc.fields) {
             // v this.fielddata najit element, jehoz key == classdesc
             // v tomto prvku fielddata najdu value (element) podle key == f
             // jeho value je chtena hodnota
-            
             var locVal = this.fielddata.get(classdesc).get(f);
 
             if(locVal instanceof content)
             {
-                val = ((content)locVal).toJson(indentation);
+                val = ((content)locVal).toJson(indentation, this.fielddata);
             }
             else {
                 val = locVal.toString();
@@ -77,24 +68,24 @@ public class instance extends contentbase {
             sb.append("\"").append(f.name).append("\"");
             sb.append(" : ");
             sb.append(val);
-            //System.out.println(sb.toString());
 
             if (!f.equals(classdesc.fields[classdesc.fields.length - 1])) {
                 sb.append(", ");
-                //System.out.println(sb.toString());
             }
         }
         indentation = indentation.substring(0, indentation.length() - 1);
 
-        sb.append("\n").append(indentation).append("}\n");
-        indentation = indentation.substring(0, indentation.length() - 1);
-        sb.append(indentation).append("}");
-        //System.out.println(sb.toString());
+        sb.append("\n").append(indentation).append("}");
+        
 
-        /*if (classdesc.getType() == contenttype.CLASSDESC && instance.indentedClasses.contains(classdesc.name)) {*/
+        if(classdesc.superclass != null)
+        {
+            sb.append(",\n");
+            sb.append(classdesc.superclass.toJson(indentation, this.fielddata));
+        }
         
-            /*instance.indentedClasses.remove(classdesc.name);
-        }*/
+        indentation = indentation.substring(0, indentation.length() - 1);
+        sb.append(indentation).append("\n}");
 
         return sb.toString();
     }
diff --git a/project/Deserializer/src/jdeserialize/stringobj.java b/project/Deserializer/src/jdeserialize/stringobj.java
index a464680..2974ee8 100644
--- a/project/Deserializer/src/jdeserialize/stringobj.java
+++ b/project/Deserializer/src/jdeserialize/stringobj.java
@@ -1,5 +1,7 @@
 package jdeserialize;
+
 import java.io.*;
+import java.util.Map;
 
 /**
  * Represents a serialized string object.  This is primarily used in serialized streams;
@@ -16,7 +18,7 @@ public class stringobj extends contentbase {
         return x;
     }
 
-    public @Override String toJson(String indetation)
+    public @Override String toJson(String indetation, Map<classdesc, Map<field, Object>> fielddata)
     {
         return "\"" + this.value + "\"";
     }
