1 29 30 package com.caucho.iiop.orb; 31 32 import java.lang.reflect.Method ; 33 34 37 public class MethodMarshal { 38 private String _name; 39 private Marshal []_args; 40 private Marshal _ret; 41 42 MethodMarshal(Method method) 43 { 44 MarshalFactory factory = MarshalFactory.create(); 45 46 _name = method.getName(); 47 48 Class []params = method.getParameterTypes(); 49 50 _args = new Marshal[params.length]; 51 52 for (int i = 0; i < params.length; i++) 53 _args[i] = factory.create(params[i]); 54 55 _ret = factory.create(method.getReturnType()); 56 } 57 58 public Object invoke(org.omg.CORBA.portable.ObjectImpl obj, 59 Object []args) 60 throws Throwable 61 { 62 org.omg.CORBA_2_3.portable.OutputStream os 63 = ((org.omg.CORBA_2_3.portable.OutputStream ) obj._request(_name, true)); 64 65 for (int i = 0; i < _args.length; i++) { 66 _args[i].marshal(os, args[i]); 67 } 68 69 org.omg.CORBA_2_3.portable.InputStream is 70 = ((org.omg.CORBA_2_3.portable.InputStream ) obj._invoke(os)); 71 72 return _ret.unmarshal(is); 73 } 74 } 75 | Popular Tags |