Refactoring of functionality used to generate records to Java