String (@NotNull PsiClass psiClass, @NotNull PsiAnnotation psiAnnotation) { final StringBuilder parametersBuilder = new StringBuilder(); final String topic = PsiAnnotationUtil.getStringAnnotationValue(psiAnnotation, "topic", ""); final boolean topicPresent = !StringUtil.isEmptyOrSpaces(topic); final List<LoggerInitializerParameter> loggerInitializerParameters = getLoggerInitializerParameters(psiClass, topicPresent); for (LoggerInitializerParameter loggerInitializerParameter : loggerInitializerParameters) { if (parametersBuilder.length() > 0) { parametersBuilder.append(", "); } switch (loggerInitializerParameter) { case TYPE -> parametersBuilder.append(psiClass.getName()).append(".class"); case NAME -> parametersBuilder.append(psiClass.getName()).append(".class.getName()"); case TOPIC -> { if (!topicPresent) { // sanity check; either implementation of CustomLogParser or predefined loggers is wrong throw new IllegalStateException("Topic can never be a parameter when topic was not set."); } parametersBuilder.append('"').append(StringUtil.escapeStringCharacters(topic)).append('"'); } case NULL -> parametersBuilder.append("null"); default -> // sanity check; either implementation of CustomLogParser or predefined loggers is wrong throw new IllegalStateException("Unexpected logger initializer parameter " + loggerInitializerParameter); } } return parametersBuilder.toString(); }