Break out method impl generation into helper objects.

Add a test showing definition of functions on java objects but not
via constructor, since apparently that doesn't work.