Add wrap() and unwrap() methods to rtypes.java

As originally suggested by @ctrueden in http://git.io/0F7HXA
(DefaultOMEROService.toOMERO), these methods take or return
arbitrary graphs of object/rtypes. See http://git.io/9roMWw
for the original implementation in Python.

This implementation includes a cache so that cycles in the
graph are short-circuited.