注釈型 RequireRangeTo


@Documented
@Target(FIELD)
@Retention(RUNTIME)
public @interface RequireRangeTo
An annotation indicating that the value is not above the upper limit.

Specify this annotation for fields that do not allow numbers to exceed the limit as follows. If this annotation is specified for an object of type other than int, long, short, byte, float, double, Integer, Long, Short, Byte, Float or Double, UnsupportedOperationException will always be thrown at runtime.

 Specify the expected value for Content Framework:
 
 @ParameterMapping( content = "Parameter" )
 public class ConcreteEntity implements ValidatableEntity, Serializable {

      @RequireRangeTo
      private int intTo;

      @RequireRangeTo( ErrorType.RECOVERABLE, message = "failed!" )
      private long longTo;

      @RequireRangeTo( ErrorType.UNRECOVERABLE, message = "failed!" )
      private double doubleTo;
 }
 
 
 Specify the expected value for the annotation:
 
 public class ConcreteEntity implements ValidatableEntity, Serializable {

      @RequireRangeTo( intTo = 100 )
      private int intTo;

      @RequireRangeTo( longTo = 100l, ErrorType.RECOVERABLE, message = "failed!" )
      private long longTo;

      @RequireRangeTo( doubleTo = 100.0d, ErrorType.UNRECOVERABLE, message = "failed!" )
      private double doubleTo;
 }
 
 
導入されたバージョン:
1.0.0
  • 任意要素の概要

    任意要素
    修飾子とタイプ 任意要素 説明
    byte byteTo
    Returns the upper limit of byte type.
    double doubleTo
    Returns the upper limit of double type.
    ErrorType errorType
    Returns the error type based on ErrorType , and ErrorType.RUNTIME is set as the default.
    float floatTo
    Returns the upper limit of float type.
    int intTo
    Returns the upper limit of int type.
    long longTo
    Returns the upper limit of long type.
    String message
    Returns the error type based on ErrorType , and empty ("") is set as the default.
    short shortTo
    Returns the upper limit of short type.
  • 要素の詳細

    • errorType

      ErrorType errorType
      Returns the error type based on ErrorType , and ErrorType.RUNTIME is set as the default.
      戻り値:
      The error type based on the ErrorType
      デフォルト:
      RUNTIME
    • message

      String message
      Returns the error type based on ErrorType , and empty ("") is set as the default.
      戻り値:
      The message
      デフォルト:
      ""
    • intTo

      int intTo
      Returns the upper limit of int type. The default value is Integer.MAX_VALUE .
      戻り値:
      The upper limit of int type
      導入されたバージョン:
      1.0.2
      デフォルト:
      2147483647
    • longTo

      long longTo
      Returns the upper limit of long type. The default value is Long.MAX_VALUE .
      戻り値:
      The upper limit of long type
      導入されたバージョン:
      1.0.2
      デフォルト:
      9223372036854775807L
    • floatTo

      float floatTo
      Returns the upper limit of float type. The default value is Float.MAX_VALUE .
      戻り値:
      The upper limit of float type
      導入されたバージョン:
      1.0.2
      デフォルト:
      3.4028235E38f
    • doubleTo

      double doubleTo
      Returns the upper limit of double type. The default value is Double.MAX_VALUE .
      戻り値:
      The upper limit of double type
      導入されたバージョン:
      1.0.2
      デフォルト:
      1.7976931348623157E308
    • shortTo

      short shortTo
      Returns the upper limit of short type. The default value is Short.MAX_VALUE .
      戻り値:
      The upper limit of short type
      導入されたバージョン:
      1.0.2
      デフォルト:
      32767
    • byteTo

      byte byteTo
      Returns the upper limit of byte type. The default value is Byte.MAX_VALUE .
      戻り値:
      The upper limit of byte type
      導入されたバージョン:
      1.0.2
      デフォルト:
      (byte)0x7f