01: /*******************************************************************************
02: * Portions created by Sebastian Thomschke are copyright (c) 2005-2007 Sebastian
03: * Thomschke.
04: *
05: * All Rights Reserved. This program and the accompanying materials
06: * are made available under the terms of the Eclipse Public License v1.0
07: * which accompanies this distribution, and is available at
08: * http://www.eclipse.org/legal/epl-v10.html
09: *
10: * Contributors:
11: * Sebastian Thomschke - initial implementation.
12: *******************************************************************************/package net.sf.oval.constraint;
13:
14: import java.lang.annotation.Documented;
15: import java.lang.annotation.ElementType;
16: import java.lang.annotation.Retention;
17: import java.lang.annotation.RetentionPolicy;
18: import java.lang.annotation.Target;
19:
20: import net.sf.oval.ConstraintViolation;
21: import net.sf.oval.configuration.annotation.Constraint;
22:
23: /**
24: * Check if the value passes a validation by Validator.validate()
25: *
26: * @author Sebastian Thomschke
27: */
28: @Documented
29: @Retention(RetentionPolicy.RUNTIME)
30: @Target({ElementType.FIELD,ElementType.PARAMETER,ElementType.METHOD})
31: @Constraint(checkWith=AssertValidCheck.class)
32: public @interface AssertValid {
33: /**
34: * error code passed to the ConstraintViolation object
35: */
36: String errorCode() default "net.sf.oval.constraints.AssertValid";
37:
38: /**
39: * message to be used for the ContraintsViolatedException
40: *
41: * @see ConstraintViolation
42: */
43: String message() default "net.sf.oval.constraints.AssertValid.violated";
44:
45: /**
46: * severity passed to the ConstraintViolation object
47: */
48: int severity() default 0;
49:
50: /**
51: * The associated validation profiles.
52: */
53: String[] profiles() default {};
54:
55: /**
56: * Specifies if the keys and values of a collection/map must be valid too.
57: */
58: boolean requireValidElements() default true;
59: }
|