注釈型 RequireStartWith


@Documented
@Target(FIELD)
@Retention(RUNTIME)
public @interface RequireStartWith
An annotation indicating that the string starts with a specific string.

Specify this annotation for fields that do not allow the string not to start 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 {

      @RequireStartWith
      private String literal;

      @RequireStartWith( errorType = ErrorType.RECOVERABLE, message = "failed!" )
      private String recoverableLiteral;
 }
 
 
 Specify the expected value for the annotation:
 
 public class ConcreteEntity implements ValidatableEntity {

      @RequireStartWith( prefix = "something" )
      private String literal;

      @RequireStartWith( prefix = "something", errorType = ErrorType.UNRECOVERABLE, message = "failed!" )
      private String unrecoverableLiteral;
 }
 
 
導入されたバージョン:
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
      導入されたバージョン:
      1.0.1
      デフォルト:
      RUNTIME
    • message

      String message
      Returns the error type based on ErrorType , and empty ("") is set as the default.
      戻り値:
      The message
      導入されたバージョン:
      1.0.1
      デフォルト:
      ""
    • prefix

      String prefix
      Returns the expected prefix of String.
      戻り値:
      The expected prefix
      導入されたバージョン:
      1.0.2
      デフォルト:
      ""