注釈型 RequireEndWith
@Documented @Target(FIELD) @Retention(RUNTIME) public @interface RequireEndWith
An annotation indicating that the string ends with a specific string.
Specify this annotation for fields that do not allow the string not to end with a specific string as follows. If this annotation is specified for an object of type other than String, UnsupportedOperationException will always be thrown at runtime.
Specify the expected value for Content Framework:
@ParameterMapping( content = "Parameter" )
public class ConcreteEntity implements ValidatableEntity {
@RequireEndWith
private String literal;
@RequireEndWith( errorType = ErrorType.RECOVERABLE, message = "failed!" )
private String recoverableLiteral;
}
Specify the expected value for the annotation:
public class ConcreteEntity implements ValidatableEntity {
@RequireEndWith( suffix = "something" )
private String literal;
@RequireEndWith( suffix = "something", 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
- 導入されたバージョン:
- 1.0.1
- デフォルト:
- RUNTIME
-
message
String messageReturns the error type based onErrorType
, and empty (""
) is set as the default.- 戻り値:
- The message
- 導入されたバージョン:
- 1.0.1
- デフォルト:
- ""
-
suffix
String suffixReturns the expected suffix of String.- 戻り値:
- The expected suffix
- 導入されたバージョン:
- 1.0.2
- デフォルト:
- ""
-