Hi, i'm working on a grails project, but I think this is a groovy question.
Some background, I have a domain Company class, and I have and several SubCompany classes that inherit from Company
Certain Users only deal with certain "types" (subclasses) of companies.
So in writing a universal search for property values, i'd like to dynamically search different types of companies depending on the user.
Below is a basic example of what i'm trying to do although it could be way off.
class MyCompany extends Company{
String getHi(){
return "HI"
}
}
def mc = "MyClass"
println $mc.getHi()
Can i dynamically instantiate a class through a variable name?
Thanks,
joe