I have a bean with name "MyProps". MyProps bean has a property "ssn". How to get the property from the bean name? I don't have the reference to the "MyProps" directly.
public class Props {
...
//methods
}
public class MyProps extends Props {
String a;
double b;
String c;
//methods
}
public class YourProps extends Props {
String d;
String e;
int f;
//methods
}
public class Search {
public static Props googlSrch(String term) {
}
public static void main (String args[] ) {
Props rtn = googlSrch("getMyProps") ; //MyProps is returned but as a Props
// I want to extract properties a, b, c without casting rtn to MyProps
Props rtn1 = googlSrch("getYourProps") ; //MyProps is returned but as a Props
//I want to get properties e,f from rtn1
}
}
Our community of experts have been thoroughly vetted for their expertise and industry experience.
The Distinguished Expert awards are presented to the top veteran and rookie experts to earn the most points in the top 50 topics.