com.planetalia.dynject.validation
Annotation Type IsURL


@Target(value={FIELD,METHOD})
@Retention(value=RUNTIME)
public @interface IsURL

Requires that the annotated element be a URL. This annotation can optionally attempt to resolve the host and even fetch the URL in order to check the validity of the value.

Author:
Alexander Hristov

Optional Element Summary
 boolean contactHost
          Specifies whether to contact the host.
 java.lang.String errorCode
          Error code to use if validation fails.
 boolean fetchURL
          Specifies whether to actually attempt to fetch the URL (only for the http and https protocols).
 java.lang.String message
          Literal message to use if validation fails.
 java.lang.String messageKey
          Message key to use if validation fails.
 boolean resolveHost
          Specifies whether to check the host by performing a DNS lookup
 int timeout
          Specifies the maximum amount of milliseconds to wait if any of the resolveHost(), contactHost() or fetchURL() attributes are set to true
 java.lang.String[] validProtocols
          Set of valid protocols.
 

validProtocols

public abstract java.lang.String[] validProtocols
Set of valid protocols. Default is the empty array, which means any protocol is allowed

Returns:
Set of valid protocols. Default is the empty array, which means any protocol is allowed
Default:
{}

resolveHost

public abstract boolean resolveHost
Specifies whether to check the host by performing a DNS lookup

Returns:
Whether to check the host by performing a DNS lookup
Default:
false

contactHost

public abstract boolean contactHost
Specifies whether to contact the host. If set to true, resolveHost() is ignored and assumed to be true, too.

Returns:
whether to contact the host
Default:
false

fetchURL

public abstract boolean fetchURL
Specifies whether to actually attempt to fetch the URL (only for the http and https protocols). If set to true, resolveHost() and contactHost() are ignored and assumed to be true.

Returns:
whether to attemp to fetch the URL (applicable only for http and https protocols)
Default:
false

timeout

public abstract int timeout
Specifies the maximum amount of milliseconds to wait if any of the resolveHost(), contactHost() or fetchURL() attributes are set to true

Returns:
Maximum amount of time in milliseconds
Default:
3000

message

public abstract java.lang.String message
Literal message to use if validation fails.

Returns:
Literal message to use if validation fails.
Default:
""

errorCode

public abstract java.lang.String errorCode
Error code to use if validation fails.

Returns:
Error code to use if validation fails.
Default:
""

messageKey

public abstract java.lang.String messageKey
Message key to use if validation fails. Default is Messages.NUMERIC

Returns:
Message key to use if validation fails.
Default:
"dynject.validation.numeric"