I am trying to create a instance of class using annotation.Lets say I have two subclass from parent class
public class Parent{
}
@(type = abc)
public class Child1 extends Parent{
}
@(type = def)
public class Child2 extends Parent{
}
Now, I want a method which will return the instance of class child1 when I pass "abc" and instance of class child2 when I pass "def". Is it possible using annotation.