Denotes that the annotated element should have a given size or length. Note that "-1" means "unset". Typically used with a parameter or return value of type array or collection.

Example:

public void getLocationInWindow(@Size(2) int[] location) {
...
}

Summary

Public constructors

Size(value: Long, min: Long, max: Long, multiple: Long)
Cmn

Public properties

Long

A maximum size, inclusive

Cmn
Long

A minimum size, inclusive

Cmn
Long

The size must be a multiple of this factor

Cmn
Long

An exact size (or -1 if not specified)

Cmn

Public constructors

Size

Size(
    value: Long = -1,
    min: Long = Long.MIN_VALUE,
    max: Long = Long.MAX_VALUE,
    multiple: Long = 1
)

Public properties

max

val maxLong

A maximum size, inclusive

min

val minLong

A minimum size, inclusive

multiple

val multipleLong

The size must be a multiple of this factor

value

val valueLong

An exact size (or -1 if not specified)