0

I have many classes (50+) in a jar file without source code

I want to make them all implement java.io.Serializable interface so they could be saved to memcached.

I guess if java reflection or dynamic proxy can do it for me,that is to say ,

I dynamically load these classes , and then ,I dynamically make them implement java.io.Serializable interface .Any one could give me some suggestions?

Vikrant Kashyap
  • 6,398
  • 3
  • 32
  • 52
wuchang
  • 3,003
  • 8
  • 42
  • 66
  • 1
    My way (with gson library): convert object to json string, put to memcached. Get from memcached as json string, parse again to object. – xuanhung2401 May 05 '16 at 10:13
  • 1
    implemeting Serializable changes the way the byte code is generated at compile time. You need the source code. – jr593 May 05 '16 at 10:13

1 Answers1

-1

One way of doing this is by using java.lang.reflect.Proxy in Java. You could read more about this here

Prashant
  • 4,775
  • 3
  • 28
  • 47