Extracted and made public helper methods from the GeneratorBase class