Refactoring Java library integration