GrTypeDefinition (@NotNull GroovyFile groovyFile, @NotNull String classSimpleName) { for (GrTypeDefinition definition : (groovyFile).getTypeDefinitions()) { if (classSimpleName.equals(definition.getName())) { return definition; } } return null; }