Save the date! Android Dev Summit is coming to Sunnyvale, CA on Oct 23-24, 2019.

Size

@Target([AnnotationTarget.VALUE_PARAMETER, AnnotationTarget.LOCAL_VARIABLE, AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY_GETTER, AnnotationTarget.PROPERTY_SETTER, AnnotationTarget.FIELD, AnnotationTarget.ANNOTATION_CLASS]) class Size
androidx.annotation.Size

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
<init>(value: Long, min: Long, max: Long, multiple: Long)

Denotes that the annotated element should have a given size or length.

Properties
Long

An exact size (or -1 if not specified)

Long

The size must be a multiple of this factor

Long

A minimum size, inclusive

Long

A maximum size, inclusive

Public constructors

<init>

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

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) { ... } 

Properties

value

val value: Long

An exact size (or -1 if not specified)

multiple

val multiple: Long

The size must be a multiple of this factor

min

val min: Long

A minimum size, inclusive

max

val max: Long

A maximum size, inclusive