Top Description Methods
org.jetbrains.annotations

public @Interface NotNull

extends Annotation
Annotations
@Documented
@Retention:CLASS
@Target:METHOD, FIELD, PARAMETER, LOCAL_VARIABLE, TYPE_USE
Imports
java.lang.annotation.*

An element annotated with NotNull claims null value is forbidden to return (for methods), pass to (parameters) and hold (local variables and fields). Apart from documentation purposes this annotation is intended to be used by static analysis tools to validate against probable runtime errors and element contract violations.

Method Summary

Modifier and TypeMethod and Description
public Class<? extends Exception>

Returns:

Custom exception type that should be thrown when not-nullity contract is violated. The exception class should have a constructor with one String argument (message). By default, IllegalArgumentException is thrown on null method arguments and IllegalStateException — on null return value.
exception
()

public String

Returns:

Custom exception message
value
()

Inherited from java.lang.annotation.Annotation:
annotationTypeequalshashCodetoString

Method Detail

exceptionback to summary
public Class<? extends Exception> exception()
Returns:Class<? extends Exception>

Custom exception type that should be thrown when not-nullity contract is violated. The exception class should have a constructor with one String argument (message). By default, IllegalArgumentException is thrown on null method arguments and IllegalStateException — on null return value.

valueback to summary
public String value()
Returns:String

Custom exception message