P
Prakash Prabhu
Hi,
I have a requirement where in I have to retrieve a set of data
from the database and populate a Collection class depending upon a
a criterion whose value is a String. The criterion itself can be of
three types (at present ) .Also the method takes 2 additional objects
of 2 different user-defined types in all three cases. For example, if
the method is initializeCollection() and the criteria are say A,B,C ,
then is it advisable to overload this method like :
For Criterion A :
boolean initializeCollection(Class1 obj1, Class2 obj2,String Avalue)
For Criterion B :
boolean initializeCollection(Class1 obj1, String Bvalue,Class2 obj2)
For Criterion C :
boolean initializeCollection(String Cvalue,Class1 obj1, Class2 obj2)
or have a single method and pass an additional ( int ) flag to indicate
the type of criterion passed :
boolean initializeCollection(Class1 obj1, Class2 obj2,String value,int type)
// type would be 0 for A,1 for B , 2 for C
Thanks for any pointers .
Regards,
Prakash
I have a requirement where in I have to retrieve a set of data
from the database and populate a Collection class depending upon a
a criterion whose value is a String. The criterion itself can be of
three types (at present ) .Also the method takes 2 additional objects
of 2 different user-defined types in all three cases. For example, if
the method is initializeCollection() and the criteria are say A,B,C ,
then is it advisable to overload this method like :
For Criterion A :
boolean initializeCollection(Class1 obj1, Class2 obj2,String Avalue)
For Criterion B :
boolean initializeCollection(Class1 obj1, String Bvalue,Class2 obj2)
For Criterion C :
boolean initializeCollection(String Cvalue,Class1 obj1, Class2 obj2)
or have a single method and pass an additional ( int ) flag to indicate
the type of criterion passed :
boolean initializeCollection(Class1 obj1, Class2 obj2,String value,int type)
// type would be 0 for A,1 for B , 2 for C
Thanks for any pointers .
Regards,
Prakash