I have an abstract class with one or two protected methods needed for the subclasses.
abstract class TransformRouteProcessor {
protected String doX(String arg1){
//doX code
}
protected int doY(String arg1) {
//doY code
}
}
The subclasses will need to implement the processor interface provided by apache camel in order to use them as the parameters for a .process method in a camel route via it's java dsl offering.What I'm struggling to make a decision on is whether the abstract class should implement this interface( which provides a single public method, process(Exchange exchange)), and have the concrete classes implement this, or should each subclass implement the interface separately? I'm struggling with the decision because I have read from some that only the classes that make use of the interface should implement it, but others are saying if the subclasses would implement the interface regardless, and the abstract class should be able to fulfill the contract that it's subclasses would, then the abstract class should implement it, and the subclasses then provide each implementation details of process.
It's worth noting that the subclasses will use the protected methods unaltered, but each implementation of the process method will vary between the subclasses, so the process method in the abstract class need not provide an implemented version of process