0 Replies Latest reply on Feb 29, 2008 3:32 PM by schlafsack

    Seam Remoting and Generics

    schlafsack

      I'm having problems using parameterized types with seam remoting.


      I have a simple method that returns a generic list:




      @WebRemote
      public NodeList<MyNode> getNodes();




      where node list is:



      public class NodeList<T>
      {
         private List<T> nodes;
         private int totalNodes;
      
         get/setNodes()
         {...}
      
         get/setTotalNodes()
         {...}
      }
      



      I have found that when calling interface.js, the resulting script contains a correct definition for MyNode but no definition of NodeList. 


      I think I've tracked the problem down to org.jboss.seam.remoting.InterfaceGenerator.appendTypeSource()



      private void appendTypeSource(OutputStream out, Type type, Set<Type> types) throws IOException
      {
          if (type instanceof Class)
          {
              ....
           appendClassSource(out, classType, types);
          }
          else if (type instanceof ParameterizedType)
          {
              for (Type t : ((ParameterizedType) type).getActualTypeArguments())
                  appendTypeSource(out, t, types);
          }
      }



      I looks like js class source is only emitted for instances of Class.  When the type is a parameterized type, the source for the type arguments is emitted, but source for the type itself is not.