remote class loading for the purpose of casting
i have an object, to which i append a container.
this container has objects of type that are not known on the
remote host.
// this is the local machine
publicclass Record1implements Interface1, Serializable{
publicdouble d = -1;
public List<String>;
}
....
publicclass Agentimplements Runnable{
.....
publicvoid run(){
...
List list =new ArrayList<Interface1>()
list.add(record1);
list.add(record2);
Socket sok = serverSocket.accept();
ObjectOutputStream oos =new ObjectOutputStream(sok.getOutputStream());
oos.writeObject(list);
}
.....
========================
// this is the remote host
......
ObjectInputStream ois =new ObjectInputStream(sok.getInputStream());
List list = (List) ois.readObject();
Iterator it = list.iterator();
while(it.hasNext()){
Interface1 record = (Interface1) it.next();
// error.... ClassCastException
i can load the class that i want to cast:
Class myClass = myLoader.loadClass("Record1");
but then what?
how do i usemyClass to cast-out the
contents oflist.
is this even possible.
summary:
all i want to do is cast out the contents of a
container with a dynamically loaded Class.
please help.

