net.sf.oval.constraint
Annotation Type DateRange


@Documented
@Retention(value=RUNTIME)
@Target(value={FIELD,PARAMETER,METHOD})
@Constraint(checkWith=DateRangeCheck.class)
public @interface DateRange

Check if the date is within the a date range.

Note: This constraint is also satisfied when the value to validate is null, therefore you might also need to specified @NotNull

Author:
Sebastian Thomschke

Optional Element Summary
 ConstraintTarget[] appliesTo
          In case the constraint is declared for an array, collection or map this controls how the constraint is applied to it and it's child objects.
 String errorCode
          error code passed to the ConstraintViolation object
 String format
          The format of the specified dates in a form understandable by the SimpleDateFormat class.
 String max
          The upper date compared against in the format specified with the dateFormat parameter.
 String message
          message to be used for the ContraintsViolatedException
 String min
          The lower date compared against in the format specified with the dateFormat parameter.
 String[] profiles
          The associated constraint profiles.
 int severity
          severity passed to the ConstraintViolation object
 String target
          An expression to specify where in the object graph relative from this object the expression should be applied.
 int tolerance
          Tolerance in milliseconds the validated value can be beyond the min/max limits.
 

appliesTo

public abstract ConstraintTarget[] appliesTo

In case the constraint is declared for an array, collection or map this controls how the constraint is applied to it and it's child objects.

Default: ConstraintTarget.VALUES

Note: This setting is ignored for object types other than array, map and collection.

Default:
VALUES

errorCode

public abstract String errorCode
error code passed to the ConstraintViolation object

Default:
"net.sf.oval.constraint.DateRange"

format

public abstract String format
The format of the specified dates in a form understandable by the SimpleDateFormat class. Defaults to the default format style of the default locale.

Default:
""

max

public abstract String max
The upper date compared against in the format specified with the dateFormat parameter. If not specified then no upper boundary check is performed.
Special values are:

Default:
""

message

public abstract String message
message to be used for the ContraintsViolatedException

See Also:
ConstraintViolation
Default:
"net.sf.oval.constraint.DateRange.violated"

min

public abstract String min
The lower date compared against in the format specified with the dateFormat parameter. If not specified then no upper boundary check is performed.
Special values are:

Default:
""

profiles

public abstract String[] profiles
The associated constraint profiles.

Default:
{}

severity

public abstract int severity
severity passed to the ConstraintViolation object

Default:
0

target

public abstract String target
An expression to specify where in the object graph relative from this object the expression should be applied.

Examples:

  • "owner" would apply this constraint to the current object's property owner
  • "owner.id" would apply this constraint to the current object's owner's property id
  • "jxpath:owner/id" would use the JXPath implementation to traverse the object graph to locate the object where this constraint should be applied.

    Default:
    ""

  • tolerance

    public abstract int tolerance
    Tolerance in milliseconds the validated value can be beyond the min/max limits. This is useful to compensate time differences in distributed environments where the clocks are not 100% in sync.

    Default:
    0


    Copyright © 2005–2015 The OVal Development Team. All rights reserved.