注釈型 RequireNonBlank
@Documented @Target(FIELD) @Retention(RUNTIME) public @interface RequireNonBlank
An annotation that indicates the field is not allowed to be set to
""
.
Specify this annotation RequireNonBlank
for fields that do not allow
""
as follows. If this annotation is specified for an object of type
other than String, UnsupportedOperationException will always be thrown at
runtime.
public class ConcreteEntity implements ValidatableEntity, Serializable {
@RequireNonBlank
private String literal;
@RequireNonBlank( errorType = ErrorType.RECOVERABLE, message = "failed!" )
private String recoverableLiteral;
@RequireNonBlank( errorType = ErrorType.UNRECOVERABLE, message = "failed!" )
private String unrecoverableLiteral;
}
- 導入されたバージョン:
- 1.0.0
-
任意要素の概要
-
要素の詳細
-
errorType
ErrorType errorTypeReturns the error type based onErrorType
, andErrorType.RUNTIME
is set as the default.- 戻り値:
- The error type based on the
ErrorType
- デフォルト:
- RUNTIME
-
message
String messageReturns the error type based onErrorType
, and empty (""
) is set as the default.- 戻り値:
- The message
- デフォルト:
- ""
-