-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNEDemarshaller.java~
38 lines (33 loc) · 1.07 KB
/
NEDemarshaller.java~
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import java.io.*;
import java.net.*;
import java.lang.reflect.*;
public class NEDemarshaller {
public static Exception demarshalException (NEException message) {
return message.getException ();
}
public static Object demarshalReturnValue (NEReturnValue message) {
return message.getReturnValue ();
}
// TODO: methodDatabase should be mapping methodId to Method objects
public static NEMethodCall demarshalMethodInvocation (NEMethodInvocation message)
throws NoSuchMethodException, SecurityException {
Method method;
if (message.isUsingId ()) {
method = null;
// get method from methodDatabase
}
else {
try {
Class<?> objectType = message.getObjectType ();
method = objectType.getMethod (
message.getMethodName (), message.getArgumentTypes ());
}
catch (ClassNotFoundException e) {
// TODO: first check if class exists
// Download class file
}
}
Object[] args = message.getArguments ();
return new NEMethodCall (method, args);
}
}