how to obtain the user code style preferences?


I need to know the member chosen prefix and suffix, to recognize
setters, and getters.

Alain

2 comments
Comment actions Permalink

Again, sorry for suggesting something that I haven't tried, but does CodeStyleManager.propertyNameToVariableName do what you need?

0
Comment actions Permalink

Thanks a lot, Kirk.

It's exactly what I needed.




Summary :
-


If you prepend all your fields with "m_",

1/ 'age' is the property name,
2/ getAge() is the getter ,

3/ the following test will pass :



CodeStyleManager csm = CodeStyleManager.getInstance(__project);

String propertyName = "age";
String varName =
csm.propertyNameToVariableName(propertyName,VariableKind.FIELD);

assertEquals ( "m_age", varName);

0

Please sign in to leave a comment.