注釈型 RequireNegative


@Documented
@Target(FIELD)
@Retention(RUNTIME)
public @interface RequireNegative
An annotation that indicates the field is not allowed to be set to positive numbers.

Specify this annotation for fields that do not allow positive numbers as follows. If this annotation is specified for an object of type other than int or Integer, UnsupportedOperationException will always be thrown at runtime.

 
 public class ConcreteEntity implements ValidatableEntity, Serializable {

      @RequireNegative
      private int number;

      @RequireNegative(errorType = ErrorType.RECOVERABLE, message = "failed!" )
      private int recoverableNumber;

      @RequireNegative(errorType = ErrorType.UNRECOVERABLE, message = "failed!" )
      private int unrecoverableNumber;
 }
 
 
導入されたバージョン:
1.0.0
  • 要素の詳細

    • 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
      デフォルト:
      ""