refactor java apis to be more Java