Hello David,
        I just joined this mailing list for the exact same reason that you posted about the MethodTarget stuff. I hacked on it a little bit and decided to add a couple of new constructors. Warning: this is just a hack. I didn't bother to look to see if there are any requirements that would preclude using the techniques I use here. Here is what I came up with:

This one just takes a Method object as an argument since that is what it wants anyway. It puts the responsibility on the programmer to get the Method. I figured that since on both the client and the server side I know what object I'm using to serialize and de-serialize the object, I can get to the method directly.
    public MethodTarget(Object targetObject, Method aMethod)
       
throws NoSuchMethodException
    {
       
this.targetObject = targetObject;
        targetMethod = aMethod;
    }
   
This one is a little different. It still takes a string as an argument, but since I left the original constructor there I had to change the order of the arguments. The String argument methodToString is supposed to be the string that is in the same format as the string that is returned from sending the methodToString method to an instance of a Method (myMethod.methodToString()).
   
public MethodTarget(String methodToString, Object targetObject)
   
throws NoSuchMethodException
{
   
this.targetObject = targetObject;
    Class cls = targetObject.getClass();
   
int i = 0;
   
if (targetMethod != null) targetMethod = null;
            Method[] methods = (
this.targetObject).getClass().getMethods();
   
while (i < methods.length) {
           
if (methods[i].toString().equalsIgnoreCase(methodToString)) {
                targetMethod = methods[i];
                i += methods.length;
            }
            i++;
    }
}

Again, this is just a hack. I don't know what requirements constrain the possible solutions, this is just what I did to make it work for me.

Noel Tijerino
Lawrence Livermore National Laboratory
[EMAIL PROTECTED]
work: 925.422.0473

Stick that in your compiler and de-bug it!

Reply via email to