注釈型 RequireRangeFromTo


@Documented
@Target(FIELD)
@Retention(RUNTIME)
public @interface RequireRangeFromTo
An annotation that indicate that the numbers are within the lower and upper limits.

Specify this annotation for fields that do not allow exceed the lower and upper limits,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 {

      @RequireRangeFromTo
      private int intFromTo;

      @RequireRangeFromTo( ErrorType.RECOVERABLE, message = "failed!" )
      private long longFromTo;

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

      @RequireRangeFromTo( intFrom = -10, intTo = 10 )
      private int intFromTo;

      @RequireRangeFromTo( longFrom = -10l, longTo = 10l, ErrorType.RECOVERABLE, message = "failed!" )
      private long longFromTo;

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

    任意要素
    修飾子とタイプ 任意要素 説明
    byte byteFrom
    Returns the lower limit of byte type.
    byte byteTo
    Returns the upper limit of byte type.
    double doubleFrom
    Returns the lower limit of double 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 floatFrom
    Returns the lower limit of float type.
    float floatTo
    Returns the upper limit of float type.
    int intFrom
    Returns the lower limit of int type.
    int intTo
    Returns the upper limit of int type.
    long longFrom
    Returns the lower limit of long 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 shortFrom
    Returns the lower limit of short type.
    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
      デフォルト:
      ""
    • intFrom

      int intFrom
      Returns the lower limit of int type. The default value is Integer.MIN_VALUE .
      戻り値:
      The lower limit of int type
      導入されたバージョン:
      1.0.2
      デフォルト:
      -2147483648
    • longFrom

      long longFrom
      Returns the lower limit of long type. The default value is Long.MIN_VALUE .
      戻り値:
      The lower limit of long type
      導入されたバージョン:
      1.0.2
      デフォルト:
      -9223372036854775808L
    • floatFrom

      float floatFrom
      Returns the lower limit of float type. The default value is Float.MIN_VALUE .
      戻り値:
      The lower limit of float type
      導入されたバージョン:
      1.0.2
      デフォルト:
      1.4E-45f
    • doubleFrom

      double doubleFrom
      Returns the lower limit of double type. The default value is Double.MIN_VALUE .
      戻り値:
      The lower limit of double type
      導入されたバージョン:
      1.0.2
      デフォルト:
      4.9E-324
    • shortFrom

      short shortFrom
      Returns the lower limit of short type. The default value is Short.MIN_VALUE .
      戻り値:
      The lower limit of short type
      導入されたバージョン:
      1.0.2
      デフォルト:
      -32768
    • byteFrom

      byte byteFrom
      Returns the lower limit of byte type. The default value is Byte.MIN_VALUE .
      戻り値:
      The lower limit of byte type
      導入されたバージョン:
      1.0.2
      デフォルト:
      (byte)0x80
    • 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