2 Replies Latest reply on Aug 5, 2003 9:23 AM by Joe Simone

    Generic DTO converter


      I have the following code that takes a collection of beans and returns an array of Data Transfer Objects, sorted for HTML display.

      public static RefDTO [] convertRefs(Collection coll) {
      Set sortedSet = new TreeSet();
      Iterator i = coll.iterator();
      while (i.hasNext()) {
      Reference ref = (Reference) i.next();
      RefDTO [] dtoa = new RefDTO[sortedSet.size()];
      return dtoa;

      What I would like is some generic function that takes class names or some other argument type and creates XDTO array based on arguments passed to it.

      How would I do this? Or where can I go to learn how I could accomplish this?

      Many thanks,