Hi All,

I am trying to write method which can return different type of objects

Java Code:
public GenObj processJob(String myParam) {
     TypeOne one = (TypeOne) ThirdPartyService.callService(myParam);
     return one;
     //or it can return 
     // TypeTwo two =  (TypeTwo) ThirdPartyService.callService(myParam);
     // return two;
}
Now my question is whether it is good design to write interface and classes as follow

Java Code:
Interface GenObj { /*empty interface*/ }
Class TypeOne implements GenObj { .... }
Class TypeTwo implements GenObj { .... }
or is there any alternative way(s) of solving this?