Control getter & setter generation


I am having some difficultly controlling how getters and setters are generated, I hope you can help me understand what I'm doing wrong.

For class attributes I can set the read-only property to prevent a setter being generated. Is there some way to prevent the generation of a getter too? Could I generate only a setter to implement a write-only policy?

For the "association end" variables (that implement navigation), setting the read-only property doesn't seem to work (i.e. a setter is still generated). How can I disable the generation of a getter for these?

I can remove all external access by declaring the "association end" variable private, but this generates private getters and setters which do not seem very useful. Is it possible to prevent the generation of these private getters and setters?

Thanks in advance!


  • In the properties view (display it with Alt-3 and type 'properties' if you don't see it) you can select the 'Legacy' style on the 'Code Style' tab to generate very basic Java code for an element. You can change the Code Style for an entire package or model - or for a single element.

    Let us know if this was what you are after.

    Best regards,
Sign In or Register to comment.