com.softicar.platform.common.core.annotations.NonNullByDefault Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of platform-common Show documentation
Show all versions of platform-common Show documentation
The SoftiCAR Platform is a lightweight, Java-based library to create interactive business web applications.
package com.softicar.platform.common.core.annotations;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* This annotation can be applied to a package, type, method or constructor in
* order to define that contained entities for which a null annotation is
* otherwise lacking should be considered as {@link NonNull}. Entities affected
* by @NonNullByDefault
are:
*
* - method return values
* - parameters of a method or constructor.
*
* Local variables are not affected.
*
* - Canceling a default
* - By using a
@NonNullByDefault
annotation with the argument
* false
, a default from any enclosing scope can be canceled for
* the element being annotated.
* - Nested defaults
* - If a
@NonNullByDefault
annotation is used within the scope
* of another @NonNullByDefault
annotation, the innermost
* annotation defines the default applicable at any given position (depending on
* the parameter {@link #value()}).
*
* Note that for applying an annotation to a package, a file by the name
* package-info.java
is used.
*/
@Documented
@Retention(RetentionPolicy.CLASS)
@Target({ ElementType.PACKAGE, ElementType.TYPE, ElementType.METHOD, ElementType.CONSTRUCTOR, ElementType.FIELD, ElementType.LOCAL_VARIABLE })
public @interface NonNullByDefault {
/**
* When parameterized with false
, the annotation specifies that
* the current element should not apply any default to un-annotated types.
*/
boolean value() default true;
}