for my develop i want to use the component-pattern because a component is part of another component.
But there is one problem. The components need different parameters in the run
-function (which must be implement).
Does someone have a idea how to realize it?
Example:
public abstract class componsite{
Componente(){...}
public void run(Object object1){......}
}
public class firstComponent extends composite{
....
public void run(Object object1){......}
@Override
}
public class secondComponent extends composite{
....
@Override
public void run(Object object1,Different Object object2){......}
}
Greetz
Use Java's Varargs as part of the Composite interface
public class secondComponent extends composite{
....
@Override
public void run(Object... object){......}
}