King Amit wrote:
Hello Guys,
I have a small doubt.
Is there anyway to get an object on runtime.
That's the
only way to get an object.
Something like this:
I have a class say Employee and has following properties name, addrees, id
Now i have an object of Employee but I have to get one of the property depending on certain conditon.
So it may be emp.getName() or emp.getID on runtime.
How do I achieve this?
It's hard to say without more details. Depending on your specific requirements and use cases, it might be as simple as
Or it might be that you'll want to use
reflection or
JavaBeans property introspection to get a property based on its name that isn't known until runtime.