Is there a #capitalizeAndUnderscore method available for getter/setter templates?

Answered

I need something like this in a getter template:

```/**
* {@value #$StringUtil.capitalizeAndUnderscore($field.name)}
*/....<snipped>```


similar to the `capitalizeAndUnderscore` from the live templates builtins: https://www.jetbrains.com/idea/help/creating-and-editing-template-variables.html

I have found this by searching around:

https://github.com/JetBrains/intellij-community/blob/master/platform/util/src/com/intellij/openapi/util/text/StringUtil.java

I think this is the class in use in the getter/setter templates, but I have no way to be sure.

Is there a method that can do what I want? Is there a way to extend the `StringUtil` class in use here?

3 comments

The StringUtil is correct, but there is no such method there. No, it's impossible to extend the velocity variable in any way. Could you please submit a request you track.jetbrains.com?

Thanks

1

Please sign in to leave a comment.