Is it possibile to create own annotation that will be visible at compile time like in Lombok lib?
Let's imagine that class has 100 buttons as fields and 100 corresponding click methods. That makes the class pretty large.
public class MainPage {
private Button logo;
private Button importImage;
private Button switcher;
// ... Buttons
public void clickOnLogo() {
Clicker.click(logo);
}
public void clickOnImportImage() {
Clicker.click(importImage);
}
public void clickOnSwitcher() {
Clicker.click(switcher);
}
// ... Corresponding click methods
}
I`d like to create some annotation to apply it for each field or for class instead of writing methods.
@Clickable
public class MainPage {
private Button logo;
private Button importImage;
private Button switcher;
}
public class Runner {
public static void main(String[] args) {
// Some code initializing the main page.........
MainPage page = new MainPage();
page.clickOnLogo();
page.clickOnImportImage();
page.clickOnSwitcher();
}
}
Aucun commentaire:
Enregistrer un commentaire