I want to validate a parameter sent to a method, it must be an interface type. What to ask?
void (Class<I> interfaceType){
if (thisisnotaninterface){
throw...
}
}
You have got a Class#isInterface()
method that does exactly what you want: -
if (!interfaceType.isInterface()) {
throw...
}
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