String (boolean normalizeDeclaration) { if (requiresBackPointer) { calculateBackpointerName(); } final @NonNls StringBuilder out = new StringBuilder(1024); if (packageName.length() > 0) out.append("package ").append(packageName).append(";\n"); out.append("public "); fields.removeAll(enumConstantFields); out.append(hasEnumConstants() ? "enum " : "class "); out.append(className); if (!typeParams.isEmpty()) { out.append('<'); boolean first = true; for (PsiTypeParameter typeParam : typeParams) { if (!first) { out.append(','); } out.append(typeParam.getText()); first = false; } out.append('>'); } if (!interfaces.isEmpty()) { out.append(" implements "); boolean first = true; for (PsiClass implemented : interfaces) { if (!first) { out.append(','); } out.append(implemented.getQualifiedName()); first = false; } } out.append("{\n"); if (requiresBackPointer) { out.append("private final ").append(originalClassName); if (!typeParams.isEmpty()) { out.append('<'); boolean first = true; for (PsiTypeParameter typeParam : typeParams) { if (!first) { out.append(','); } out.append(typeParam.getName()); first = false; } out.append('>'); } out.append(' ').append(backPointerName).append(";"); } outputFieldsAndInitializers(out, normalizeDeclaration); if (hasEnumConstants()) { final String fieldName = getValueFieldName(); out.append("private final ").append(myEnumParameterType.getCanonicalText()).append(" ").append(fieldName).append(";\n"); outputConstructor(out); out.append("public ").append(myEnumParameterType.getCanonicalText()).append(" ") .append(getterName()).append("(){\nreturn ").append(fieldName).append(";\n}\n"); } else if (needConstructor() || requiresBackPointer) { outputConstructor(out); } outputMethods(out); outputInnerClasses(out); out.append("}"); return out.toString(); }