Why Android Studio annotations don't have @DoubleRange comments like @IntRange and @FloatRange

I read this article in Android Studio support annotations today and started using these annotations in my code, here is an example:

public final static class GoogleMapsZoomLevel {

    public static final int MIN_ZOOM_LEVEL = 0;
    public static final int MAX_ZOOM_LEVEL = 21;

    ..

    public GoogleMapsZoomLevel(@IntRange(from=MIN_ZOOM_LEVEL, to=MAX_ZOOM_LEVEL) int zoomLevel) {
        if (zoomLevel < MIN_ZOOM_LEVEL || zoomLevel > MAX_ZOOM_LEVEL) {
            throw new IllegalArgumentException(ERROR_ZOOM_LEVEL_OUT_OF_BOUNDS);
        }
        this.zoomLevel = zoomLevel;
    }
    ..
}

Further in my code, I have a class that takes doublevalues ​​in its constructor, but there is no @DoubleRange annotation. Am I using @FloatRange or nothing at all? Same question for valueslong

+4
source share
1 answer

Actually, the @FloatRange documentation states:

Denotes that the annotated element should be a float or double in the given range

And a similar situation for @IntRange

Denotes that the annotated element should be an int or long in the given range
+5
source

Source: https://habr.com/ru/post/1611070/


All Articles