code: private <T> List<T> parseArray(JSONArray items, Class<T> clazz) {
  
          List<T> result = new ArrayList<T>();
          for (Object onode : items) {
              JSONObject jnode = (JSONObject) onode;
  
              T item;
              try {
                  item = clazz.getDeclaredConstructor(JSONObject.class, DGraph.class).newInstance(jnode, this);
              } catch (InstantiationException | 
                      IllegalAccessException | 
                      IllegalArgumentException | 
                      InvocationTargetException | 
                      NoSuchMethodException | 
                      SecurityException e) {
                  throw new AamWriterException(e);
              }
  
              result.add(item);
          }
          return result;
      }
docs: /*
  this method can be extracted to a utils class if needed