use of org.jetbrains.plugins.groovy.lang.psi.impl.synthetic.GroovyScriptClass in project intellij-community by JetBrains.
the class ClassGenerator method writeTypeDefinition.
public void writeTypeDefinition(StringBuilder text, @NotNull final PsiClass typeDefinition, boolean toplevel, boolean insertPackageSmst) {
final boolean isScript = typeDefinition instanceof GroovyScriptClass;
final GroovyFile containingFile = (GroovyFile) typeDefinition.getContainingFile();
if (insertPackageSmst) {
writePackageStatement(text, containingFile.getPackageDefinition());
}
GenerationUtil.writeDocComment(text, typeDefinition, true);
boolean isEnum = typeDefinition.isEnum();
boolean isAnnotationType = typeDefinition.isAnnotationType();
boolean isInterface = typeDefinition.isInterface();
ModifierListGenerator.writeClassModifiers(text, typeDefinition.getModifierList(), typeDefinition.isInterface(), typeDefinition.isEnum(), toplevel, classItemGenerator.generateAnnotations());
if (isAnnotationType) {
text.append('@');
}
if (isInterface) {
text.append("interface");
} else if (isEnum) {
text.append("enum");
} else {
text.append("class");
}
text.append(' ').append(typeDefinition.getName());
GenerationUtil.writeTypeParameters(text, typeDefinition, classNameProvider);
text.append(' ');
if (isScript) {
text.append("extends ").append(GroovyCommonClassNames.GROOVY_LANG_SCRIPT).append(' ');
} else if (!isEnum && !isAnnotationType) {
classItemGenerator.writeExtendsList(text, typeDefinition);
classItemGenerator.writeImplementsList(text, typeDefinition);
}
text.append("{\n");
writeMembers(text, typeDefinition);
text.append('}');
}
Aggregations