record (@NotNull PsiClass record, @NotNull List<String> names) { static PatternModel create(@NotNull PsiClass record, @NotNull PsiElement context) { JavaCodeStyleManager manager = JavaCodeStyleManager.getInstance(record.getProject()); List<String> names = ContainerUtil.map(record.getRecordComponents(), cmp -> manager.suggestUniqueVariableName(cmp.getName(), context, true)); return new PatternModel(record, names); } String getCanonicalText() { return EntryStream.zip(Arrays.asList(record.getRecordComponents()), names) .mapKeyValue((cmp, name) -> cmp.getType().getCanonicalText() + " " + name) .joining(", ", record.getQualifiedName() + "(", ")"); } @Override public String toString() { return EntryStream.zip(Arrays.asList(record.getRecordComponents()), names) .mapKeyValue((cmp, name) -> cmp.getType().getPresentableText() + " " + name) .joining(", ", record.getName() + "(", ")"); } }