Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Eclipse with Lombok - search for getter and setter usages

I'm using Eclipse with Lombok. The getters and setters are generated properly but they are not visible in class body (that's the whole point, I know). However, because of that, I am unable to execute a search for usages of a getter or a setter from inside the class. So if I want to check what and where actually sets a particular value of a field, I have to execute a String search for the getter name, which is slow and may give bad results (for a field of the same name in another class, for example).

Is there a way in Eclipse to look for a getter/setter usage for a field for lombok-generated methods?

like image 874
Dariusz Avatar asked Mar 07 '17 09:03

Dariusz


People also ask

How do you use getter and setter with Lombok?

You can annotate any field with @Getter and/or @Setter , to let lombok generate the default getter/setter automatically. A default getter simply returns the field, and is named getFoo if the field is called foo (or isFoo if the field's type is boolean ).

What is the use of setter and getter?

Getters and setters are used to protect your data, particularly when creating classes. For each instance variable, a getter method returns its value while a setter method sets or updates its value. Given this, getters and setters are also known as accessors and mutators, respectively.

What is the use of @data in Lombok?

@Data is a convenient shortcut annotation that bundles the features of @ToString , @EqualsAndHashCode , @Getter / @Setter and @RequiredArgsConstructor together: In other words, @Data generates all the boilerplate that is normally associated with simple POJOs (Plain Old Java Objects) and beans: getters for all fields, ...


1 Answers

You can use the Outline view: outline view showing getter/setter

Right-click on the method in the Outline view, and use "Open Call Hierarchy".

An other way to do it is to right-click on the annotation (@Setter for instance), and use "Open Call Hierarchy" on it, but it may not work with some annotations (like @Data).

like image 140
Florent Bayle Avatar answered Sep 17 '22 15:09

Florent Bayle