org.hibernate.validator.constraints
Annotation Type URL


@Documented
@Constraint(validatedBy={})
@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
 javax.validation.constraints.Pattern.Flag[] flags
           
 Class<?>[] groups
           
 String host
           
 String message
           
 Class<? extends javax.validation.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 javax.validation.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:
an additional regular expression the annotated URL must match. The default is any string ('.*')
Default:
".*"

flags

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


Copyright © 2012 Oracle Corporation. All Rights Reserved.