jeudi 7 mars 2019

Java - Getting a list of fields that have a common super class from an object

I want to get a list of fields that have a common super class from an object and then iterate on them and perform a method existing in the super class. Example :

class BasePage{
***public void check(){}***
}}

class Page extends BasePage{
private TextElement c;
private ButtonElement e;
//methods acting on c and e}

class TextElement extends BaseElement {

}}

class ButtonElement extends BaseElement {

}}

class BaseElement {
public void exits(){};
}}

So from the BasePage class I want to implement the check method which should parse the list of fields of a page, then get the list of the fields having the super class baseElement, then for each one launch the method exists.





Aucun commentaire:

Enregistrer un commentaire