This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Hi! I use RMI adn I try to encapsulate some properties from the server side and send them on the client side.For this I have an "encap" interface (it extends Serializable) with a lot of gets/sets.This interface is implemented by a inner class on the server side, the server has a get method with the return type my encapsulate interface.Is this ok or I must build an extern "encap"class.
Yeep , I must admit a very ingenious solution. If I understand good the probmem is (and this is 100% right) an non static inner class can not have static members, and in my case I need the : "serialVersionUID".From here the solution need basics class knowledges.
But with all of this the solution is still hard to "digest" whithout a solid java base and if you'er working in a team ......
You have to the weird constructor in the static inner class for it to work -
You also can use non-static serializable inner classes... but you may run into big problems with versioning (since you can't create the static serialVersionUID without doing the weird static inner class wrapping a regular inner class solution above). With all the hoops you have to jump through though, I would suggest just using regular serializable non-inner classes.