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 string representation is not empty and
25: * does not only contain white spaces.
26: *
27: * <br><br>
28: * <b>Note:</b> This constraint is also satisified when the value to validate is null, therefore you might also need to specified @NotNull
29: *
30: * @author Sebastian Thomschke
31: */
32: @Documented
33: @Retention(RetentionPolicy.RUNTIME)
34: @Target({ElementType.FIELD,ElementType.PARAMETER,ElementType.METHOD})
35: @Constraint(checkWith=NotBlankCheck.class)
36: public @interface NotBlank {
37: /**
38: * error code passed to the ConstraintViolation object
39: */
40: String errorCode() default "net.sf.oval.constraints.NotBlank";
41:
42: /**
43: * message to be used for the ContraintsViolatedException
44: *
45: * @see ConstraintViolation
46: */
47: String message() default "net.sf.oval.constraints.NotBlank.violated";
48:
49: /**
50: * severity passed to the ConstraintViolation object
51: */
52: int severity() default 0;
53:
54: /**
55: * The associated validation profiles.
56: */
57: String[] profiles() default {};
58: }
|