00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031 package org.objectweb.proactive.core.util;
00032
00033 import java.io.Serializable;
00034 import java.lang.reflect.Method;
00035
00036
00037 public class SerializableMethod implements Serializable {
00038 private transient Method m;
00039
00040 public SerializableMethod(Method m) {
00041 this.m = m;
00042 }
00043
00044 public Method getMethod() {
00045 return m;
00046 }
00047
00048 private void writeObject(java.io.ObjectOutputStream out)
00049 throws java.io.IOException {
00050 System.out.println("writing WrappedMethod");
00051 out.writeObject(m.getDeclaringClass());
00052 out.writeObject(m.getName());
00053 out.writeObject(m.getParameterTypes());
00054 }
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076 private void readObject(java.io.ObjectInputStream in)
00077 throws java.io.IOException, ClassNotFoundException {
00078 System.out.println("reading WrappedMethod");
00079 Class declaringClass = (Class) in.readObject();
00080 String name = (String) in.readObject();
00081 Class[] paramTypes = (Class[])in.readObject();
00082
00083 try {
00084 m = declaringClass.getMethod(name, paramTypes);
00085 } catch (SecurityException e) {
00086 e.printStackTrace();
00087 } catch (NoSuchMethodException e) {
00088 e.printStackTrace();
00089 }
00090 }
00091
00092 @Override
00093 public int hashCode() {
00094 return m.hashCode();
00095 }
00096
00097 @Override
00098 public String toString() {
00099 return m.toString();
00100 }
00101
00102 @Override
00103 public boolean equals(Object obj) {
00104 if (! (obj instanceof SerializableMethod)) {
00105 return false;
00106 }
00107 return m.equals(((SerializableMethod)obj).getMethod());
00108 }
00109
00110
00111
00112 }