Package org.apache.sis.measure

# Annotation Type ValueRange

@Documented @Target({FIELD,METHOD}) @Retention(RUNTIME) public @interface ValueRange
The range of values assignable to a field, or to a JavaBean property. When used with JavaBeans, this annotation shall be applied on the getter method as in the following example:

>     @ValueRange(minimum=0, maximum=100)
>     public double getCloudCoverPercentage() {
>         // Method implementation here...
>     }

By default, both endpoints are inclusive. To make an endpoint exclusive, a `isFooInclusive` argument needs to be explicitly provided. This is useful mostly for floating point numbers. In the following example, values can be very close to zero but not equals, since a value of exactly zero makes no sense. Note also that the `maximum` value is not explicitly provided, in which case it defaults to infinity.

>     @@ValueRange(minimum=0, isMinIncluded=false)
>     public double getSpatialResolution() {
>         // Method implementation here...
>     }

It is sometime convenient to convert `ValueRange` to `NumberRange` instances in order to leverage the various `NumberRange` operations. The following example uses a convenience constructor for this purpose. Note that the `Double` type could by inferred from `Method​.getReturnType()`.

>     Method myMethod = ...;
>     ValueRange annotation = myMethod.getAnnotation(ValueRange.class);
>     if (annotation != null) {
>         NumberRange<Double> range = new NumberRange(Double.class, annotation);
>         // Use the range here.
>     }

The `AbstractMetadata` class uses this annotation for inferring `ParameterDescriptor` from metadata interfaces and implementation classes.

Since:
  0.3
See Also:
  - `NumberRange(Class, ValueRange)`

Defined in the `sis-utility` module

- ## Optional Element Summary

  Optional Elements
  Modifier and Type
  Optional Element
  Description
  `boolean`
  `isMaxIncluded`
  `true` if the maximal value is inclusive, or `false` if it is exclusive.
  `boolean`
  `isMinIncluded`
  `true` if the minimal value is inclusive, or `false` if it is exclusive.
  `double`
  `maximum`
  Returns the maximal value that a method can return.
  `double`
  `minimum`
  Returns the minimal value that a method can return.

- ## Element Details

  - ### minimum

    double minimum
    Returns the minimal value that a method can return. The default value is negative infinity, which means that there is no minimal value.
    Returns:
      the minimal value.
    Default:
      -1.0/0.0

  - ### isMinIncluded

    boolean isMinIncluded
    `true` if the minimal value is inclusive, or `false` if it is exclusive. By default the minimum value is inclusive.
    Returns:
      `true` if the minimum value is inclusive.
    Default:
      true

  - ### maximum

    double maximum
    Returns the maximal value that a method can return. The default value is positive infinity, which means that there is no maximal value.
    Returns:
      the maximal value.
    Default:
      1.0/0.0

  - ### isMaxIncluded

    boolean isMaxIncluded
    `true` if the maximal value is inclusive, or `false` if it is exclusive. By default the maximum value is inclusive.
    Returns:
      `true` if the maximum value is inclusive.
    Default:
      true