In short, I have a function that accepts a variable number of params and another function that also accepts a variable number of paramaters, I need to forward all the variable paramaters in the method plus some extra to the second method that accepts variable paramaters ...
action1(new Filter1());
action2(new Filter1(), new Filter2());
public void action1(Object ... params){
actionGeneric(new Action1(), params);
}
public void action2(Object ... params){
actionGeneric(new Action2(), params);
}
public void actionGeneric(Object ... params){
for (Object param : params){
if (param instanceof Action1){
// works fine
} else if (param instanceof Action2){
// works fine
} else if (param instanceof Filter1){
// never gets here
} else if (param instanceof Filter2){
// never gets here
}
}
}
So my question is, how should I be forwarding those params in action1 / action2 in order for actionGeneric to see them as Filter1 / Filter2 instances and not (I'm guessing) array type?