I just found code like this in a (quite expensive) Java framework i was evaluating (Note: I edited the API Documentation and the name of the method):
/**
* Used to set some value and change some behaviour based on this
* value.
* API users should not call this method with {@code false}.
* Instead you should invoke
* {@link #anotherMethodThatDoesTheOpposite()}.
*
* @param b {@code true} to do something (false does nothing)
*/
public void setSomeValue(boolean b) {
/* here is some code that does something if b is true */
}
Nice, isn’t it? A method with a boolean parameter which must be true.