親クラスの子クラス変数にアクセスしようとしています。以下のコードスニペットに基づいて続行する方法を提案できますか?
public abstract class Base{
//some abstract methods
//one more method to parse the xml
public final void parseXml(){
String clName = Thread.currentThread().getStackTrace()[1].getClassName(); //child class name
if(xmlFile_+clName){ //i am trying to access "Test.xmlFile_Test",
//execute the if string is available
}
}
}
public class Test extends Base{
public static final String xmlFile_Test = "<Hello>sample</Hello>";
public int execute(){
parseXml(); //This should call base class method
}
}
私の間違ったステップはどこにありますか..これはあなたが答えるのを助けるかもしれない疑似コードです