@@ -242,6 +242,7 @@ public <T> T traverseJsonObject(JsonObject root) {
242242            }
243243            visited .put (jsonObj , null );
244244            traverseSpecificType (jsonObj );
245+ //            jsonObj.setFinished(); 
245246        }
246247        return  (T ) root .getTarget ();
247248    }
@@ -453,11 +454,11 @@ private Object createInstanceUsingType(JsonObject jsonObj) {
453454
454455    /** 
455456     * If a ClassFactory is associated to the passed in Class (clazz), then use the ClassFactory 
456-      * to create an instance.  If a ClassFactory create  the instance, it may optionall  load 
457+      * to create an instance.  If a ClassFactory creates  the instance, it may optionally  load 
457458     * the values into the instance, using the values from the passed in JsonObject.  If the 
458459     * ClassFactory instance creates AND loads the object, it is indicated on the ClassFactory 
459460     * by the isObjectFinal() method returning true.  Therefore, the JsonObject instance that is 
460-      * loaded, is marked with 'isFinished=true' so that no more process  is needed for this instance. 
461+      * loaded, is marked with 'isFinished=true' so that no more processing  is needed for this instance. 
461462     */ 
462463    Object  createInstanceUsingClassFactory (Class  c , JsonObject  jsonObj ) {
463464        // If a ClassFactory exists for a class, use it to instantiate the class.  The ClassFactory 
@@ -689,4 +690,20 @@ Object createJavaFromJson(Object root) {
689690            return  root ;
690691        }
691692    }
693+ 
694+     Object  resolveArray (Class <?> suggestedType , List <Object > list )
695+     {
696+         if  (suggestedType  == null  || suggestedType  == Object .class ) {
697+             // No suggested type, so use Object[] 
698+             return  list .toArray ();
699+         }
700+         
701+         JsonObject  jsonArray  = new  JsonObject ();
702+         jsonArray .setTarget (Array .newInstance (suggestedType , list .size ()));
703+         jsonArray .setJsonArray (list .toArray ());
704+         traverseJsonObject (jsonArray );
705+         jsonArray .setFinished ();
706+ //        return jsonArray.getTarget(); 
707+         return  jsonArray ;
708+     }
692709}
0 commit comments