org.hibernate.validator.constraints
Annotation Type URL


@Documented
@Constraint(validatedBy=URLValidator.class)
@Target(value={METHOD,FIELD,ANNOTATION_TYPE,CONSTRUCTOR,PARAMETER})
@Retention(value=RUNTIME)
@Pattern(regexp="")
public @interface URL

Validate that the string is a valid URL.

Author:
Hardy Ferentschik

Optional Element Summary
 Pattern.Flag[] flags
           
 Class<?>[] groups
           
 String host
           
 String message
           
 Class<? extends Payload>[] payload
           
 int port
           
 String protocol
           
 String regexp
           
 

message

public abstract String message
Default:
"{org.hibernate.validator.constraints.URL.message}"

groups

public abstract Class<?>[] groups
Default:
{}

payload

public abstract Class<? extends Payload>[] payload
Default:
{}

protocol

public abstract String protocol
Returns:
the protocol (scheme) the annotated string must match, eg ftp or http. Per default any protocol is allowed
Default:
""

host

public abstract String host
Returns:
the host the annotated string must match, eg localhost. Per default any host is allowed
Default:
""

port

public abstract int port
Returns:
the port the annotated string must match, eg 80. Per default any port is allowed
Default:
-1

regexp

public abstract String regexp
Returns:
a regular expression the annotated must match. The default is any string ('.*')
Default:
".*"

flags

public abstract Pattern.Flag[] flags
Returns:
used in combination with regexp() in order to specify a regular expression option
Default:
{}


Copyright © 2007-2011 Red Hat Middleware, LLC. All Rights Reserved