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: import net.sf.oval.constraint.AssertURLCheck.URIScheme;
23:
24: /**
25: * Check if the value passes a validation by Validator.validate()
26: *
27: * @author Sebastian Thomschke
28: */
29: @Documented
30: @Retention(RetentionPolicy.RUNTIME)
31: @Target({ElementType.FIELD,ElementType.PARAMETER,ElementType.METHOD})
32: @Constraint(checkWith=AssertURLCheck.class)
33: public @interface AssertURL {
34: /**
35: * Specifies if a connection to the URL should be attempted to verify its validity.
36: */
37: boolean connect() default false;
38:
39: /**
40: * error code passed to the ConstraintViolation object
41: */
42: String errorCode() default "net.sf.oval.constraints.AssertURL";
43:
44: /**
45: * message to be used for the ContraintsViolatedException
46: *
47: * @see ConstraintViolation
48: */
49: String message() default "net.sf.oval.constraints.AssertURL.violated";
50:
51: /**
52: * Specifies the allowed URL schemes.
53: */
54: URIScheme[] permittedURISchemes() default { URIScheme.HTTP,
55: URIScheme.HTTPS, URIScheme.FTP };
56:
57: /**
58: * severity passed to the ConstraintViolation object
59: */
60: int severity() default 0;
61:
62: /**
63: * The associated validation profiles.
64: */
65: String[] profiles() default {};
66: }
|