views:

115

answers:

2

I need to know which is the language used in the template code used for generating getter/setter methods in MyEclipse.

1) I want to use my static utility method in the getter/setter method template code of myeclipse. 2) I want to invoke my utility method only when the field data type is String.

A: 

Velocity is used in all templates.

Eugene
A: 

Window > Preferences > Java > Editor > Templates will let you add new templates for your code. You could create the templates in there, and if you name it StringGetterSetter, all you'd have to do would be to type "str ctrl-space enter" and it would insert the methods.

You could use the setter/getter templates in Window > Preferences > Java > Code Style > Code Templates > Code > Getter Body as a base to copy from.

I take it you'd rather adjust these so that they will automatically detect when the type is a String, and adjust what code is inserted. I don't think there are variables in here that will tell you the type of the field being set/got. The elemType function is available in the Editor > Templates section that would allow more sophisticated checks.

(I use MyEclipse 8.0)

John