Does an interface with this contract
start();
stop();
Already exist?
I have the impression to recode something classic here...
Yes you should write proper Javadoc comments for your interfaces to clearly specific the motivation behind the interface and what the contract is for both callers and implementors.
But if you really really want to know the theoretical maximum number of interfaces a class can implement, it's 65535.
Interfaces in Java In the Java programming language, an interface is a reference type, similar to a class, that can contain only constants, method signatures, default methods, static methods, and nested types. Method bodies exist only for default methods and static methods.
I don't think so, but I'd say even if it does, it'd be much handier to write your own just in case in the future you need to amend it and add a pause();
or similar.
org.springframework.context.Lifecycle
No, at least not without including additional packages, but it's quite easy to create one:
public interface StartAndStoppable { //I am *terrible* at coming up with names :P
public void start();
public void stop();
}
This is good because you can also add new methods if needed later.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With