It's very simple question, I often use com.google.common.base.Preconditions in my projects to validate arguments and parameters, for example:
Preconditions.checkNotNull(parameter, "message");
Preconditions.checkArgument(parameter > 0, "message");
this code may produce IllegalArgumentException or NPE. But very often I need throw own exception. How can I do it by this library? Or maybe you can advise another one? thank you in advance!
UPDATE: I understand, that I can to create own simple utility class, but I'm interested to find ready-made solutions. Please, let me know, if somebody know it's possible.
That's the solution I finally came to. It does exactly what I wanted. Might be useful to anybody:
}