org.javalid.annotations.validation
Annotation Type DateCheck


@Target(value={METHOD,FIELD})
@Retention(value=RUNTIME)
@Documented
public @interface DateCheck

Checks if annotated method/field returns a value that applies to this date constraint.

Since:
1.1
Version:
1.0
Author:
M.Reuvers

Optional Element Summary
 java.lang.String[] applyToGroups
          Specify for which groups this annotation must be applied.
 int convertType
          The dates are converted to this type, meaning that the actual comparison is done this way (e.g TYPE_CONVERT_DATE means that the dates are compared on their date's only, time is not included).
 java.lang.String customCode
          Optional custom code (property from a properties file).
 boolean globalMessage
          If this annotation's message must be added as global message instead of real validation path.
 int mode
          The mode used for comparison, use one of the MODE_ constants of this annotation.
 java.lang.String pattern
          The pattern to use to convert the value() to a valid Date (uses the formats supported by java.util.SimpleDateFormatter).
 boolean today
          The date value that is used for comparison.
 java.lang.String value
          The date value to use for comparison (used only if today() is set to false).
 

today

public abstract boolean today
The date value that is used for comparison. By default this one is true, meaning it will use todays date for comparison. If you need to specify another, set this one to false and set the value.

Default:
true

mode

public abstract int mode
The mode used for comparison, use one of the MODE_ constants of this annotation. Defaults to MODE_EQUALS.

Default:
0

convertType

public abstract int convertType
The dates are converted to this type, meaning that the actual comparison is done this way (e.g TYPE_CONVERT_DATE means that the dates are compared on their date's only, time is not included). Defaults to TYPE_CONVERT_DATE. Use one the the TYPE_CONVERT_ constants of this class.

Default:
1

value

public abstract java.lang.String value
The date value to use for comparison (used only if today() is set to false). Use a valid format according to the pattern() property. See pattern for more info. Defaults to an empty string.

Default:
""

pattern

public abstract java.lang.String pattern
The pattern to use to convert the value() to a valid Date (uses the formats supported by java.util.SimpleDateFormatter).

Note you can include any format you like, but remember that comparison can be done in 3 different modes, irrelevant of this format. See compareType(). Pattern defaults to yyyy-MM-dd.

Default:
"yyyy-MM-dd"

applyToGroups

public abstract java.lang.String[] applyToGroups
Specify for which groups this annotation must be applied. By default if you annotate without this variable, the annotation is applied for any group on that method (which is what you usually want). However by specifying the exact groups you can turn on/off a validation on a method depending on the group you validate.

Defaults to JvGroup.GROUP_APPLY_ALL

Default:
"_all_"

customCode

public abstract java.lang.String customCode
Optional custom code (property from a properties file). If set, this one is used instead of the default one specified in MessageCodes for annotated method.

This way you can override the default message if needed.

Default:
""

globalMessage

public abstract boolean globalMessage
If this annotation's message must be added as global message instead of real validation path. Defaults to false (thus will be added with validation path if invalid).

Default:
false