public static Optional<PsiMethod> createToBuilderMethodIfNecessary(@NotNull PsiClass containingClass,
                                                                     @NotNull PsiClass builderBaseClass,
                                                                     @NotNull PsiClass builderImplClass,
                                                                     @NotNull PsiAnnotation psiAnnotation,
                                                                     @NotNull PsiClassType psiTypeBaseWithGenerics) {
    if (!shouldGenerateToBuilderMethods(psiAnnotation)) {
      return Optional.empty();
    }

    final LombokLightMethodBuilder methodBuilder = new LombokLightMethodBuilder(containingClass.getManager(), TO_BUILDER_METHOD_NAME)
      .withMethodReturnType(psiTypeBaseWithGenerics)
      .withContainingClass(containingClass)
      .withNavigationElement(psiAnnotation)
      .withModifier(PsiModifier.PUBLIC);

    final String blockText = String.format("return new %s().%s(this);",
                                           PsiClassUtil.getTypeWithGenerics(builderImplClass).getCanonicalText(false),
                                           FILL_VALUES_METHOD_NAME);
    methodBuilder.withBodyText(blockText);

    createRelevantNonNullAnnotation(containingClass, methodBuilder);

    return Optional.of(methodBuilder);
  }
public static Optional<PsiMethod> createToBuilderMethodIfNecessary(@NotNull PsiClass containingClass,
                                                                     @NotNull PsiClass builderBaseClass,
                                                                     @NotNull PsiClass builderImplClass,
                                                                     @NotNull PsiAnnotation psiAnnotation,
                                                                     @NotNull PsiClassType psiTypeBaseWithGenerics)