String () { boolean recordsAvailable = HighlightingFeature.RECORDS.isAvailable(myFile) && !ContainerUtil.exists(fields, ParameterSpec::isSetterRequired); @NonNls final StringBuilder out = new StringBuilder(1024); if (packageName.length() > 0) out.append("package ").append(packageName).append(';'); out.append('\n'); out.append(myVisibility).append(" "); out.append(recordsAvailable ? PsiKeyword.RECORD : PsiKeyword.CLASS); out.append(" ").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 (recordsAvailable) { out.append("("); fields.stream().map(param -> param.getType().getCanonicalText(true) + " " + param.getName()); StringUtil.join(fields, param -> { PsiType type = param.getType(); if (param.getParameter().isVarArgs() && type instanceof PsiArrayType) { type = new PsiEllipsisType(((PsiArrayType)type).getComponentType(), type.getAnnotations()); } return type.getCanonicalText(true) + " " + param.getName(); }, ", ", out); out.append("){}"); } else { out.append('\n'); out.append('{'); outputFields(out); outputConstructor(out); outputGetters(out); outputSetters(out); out.append("}\n"); } return out.toString(); }