Size

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:

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

Summary

Public methods

abstract @NonNull long
max()

A maximum size, inclusive

abstract @NonNull long
min()

A minimum size, inclusive

abstract @NonNull long

The size must be a multiple of this factor

abstract @NonNull long

An exact size (or -1 if not specified)

Extension functions

final @RequiresApi(value = "21") int

Returns "width", the first component of this Size.

final @RequiresApi(value = "21") int

Returns "height", the second component of this Size.

Public methods

max

@NonNull
public abstract long max()

A maximum size, inclusive

min

@NonNull
public abstract long min()

A minimum size, inclusive

multiple

@NonNull
public abstract long multiple()

The size must be a multiple of this factor

value

@NonNull
public abstract long value()

An exact size (or -1 if not specified)

Extension functions

SizeKt.component1

@RequiresApi(value = "21")
@NonNull
public final @RequiresApi(value = "21") int SizeKt.component1(@NonNull Size receiver)

Returns "width", the first component of this Size.

This method allows to use destructuring declarations when working with sizes, for example:

val (w, h) = mySize

SizeKt.component2

@RequiresApi(value = "21")
@NonNull
public final @RequiresApi(value = "21") int SizeKt.component2(@NonNull Size receiver)

Returns "height", the second component of this Size.

This method allows to use destructuring declarations when working with sizes, for example:

val (w, h) = mySize