Refactor NullClassBuilder#generate_class

Seems that this can be refactored further.