Как то так:
public class Parent {}
public class ChildA extends Parent {}
public class ChildB extends Parent {}
public class Test
{
public static <T extends Parent> T test()
{
if(T.getClass() == ChildA.class)
return new ChildA();
else
if(T.getClass() == ChildB.class)
return new ChildB();
else throw new Exception("123");
}
}
ChildA a0 = Test.<ChildA>test(); //Ok
ChildA a1 = Test.<ChildB>test(); //Fail