I am describing a grid or table view using Selenium. What I want to do is to develop an abstract class Table from which another classes will inherit. Here is the idea:
AbstractTable class:
public abstract class AbstractTable extends HtmlElement {
public abstract Class<? extends AbstractRow> getHeader();
public abstract Class<? extends AbstractRow> getRow();
private Class<? extends AbstractRow> tableHeader = getHeader();
private Class<? extends AbstractRow> tableRow = getRow();
public AbstractTable() { // init method }
}
AbstractRow class:
@FindBy(xpath = ".//thead/tr")
public abstract class AbstractRow extends HtmlElement {
@Override
public Rectange getRect() { return null; }
}
MyTable class:
class MyTable extends AbstractTable {
@Override
public Class<? extends AbstractRow> getHeader() { return TableHead.class; }
@Override
public Class<? extends AbstractRow> getRow() { return TableRow.class; }
@FindBy(xpath = ".//thead/tr")
public static class TableHead extends AbstractRow { // some fields }
@FindBy(xpath = ".//tbody/tr[not(@class = 'clicked')]")
public static class TableRow extends AbstractRow { // some fields }
}
Imagine that there are more than one class which is similar to MyTable.
So, my main question is: will my inner classes of class MyTable be decorated and initialized? Or, if not, then maybe there is a way to do this more efficient?