I have several queues that all extend a Queue class. I want to do a Queue manger base class to handle adding to the queue (and other operations).
If you take a look at the following code, I created a base class called QueueManger that has a static method called add() that will get 'Queue' and add a variable to it. I want to make getQueue() (called in add() ) abstract because I want to force other classes to provide their own implementation of the 'Queue'. The issue is I can't declare abstract static method. What is the right way to solve this?
public class RegistrationQueueManger { @Override Queue getQueue() { return new RegistrationQueue(); // RegistrationQueue is a class that // extends Queue.java } } public abstract class QueueManger { abstract static Queue getQueue(); // Error: cant do! (in java) public static Add(String myvar) { getQueue().add(myvar); } } Note: I saw some question about this subject but it didn't really give a good answer of how to solve it and create another design to handling it.