com.planetalia.dynject.validation
Annotation Type IsNumeric


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

Requires that the value be a numeric value. If it is not, it will attempt to perform a conversion according either using a provided pattern, or using the locale-dependant default pattern. Usually numeric conversions are performed automatically. You should use this annotation only if you want to specify a custom numeric pattern.

Author:
Alexander Hristov

Optional Element Summary
 java.lang.String defaultValue
          If set to something different than the default (the empty string), specifies a default value that is used whenever a null value is received.
 java.lang.String errorCode
          Error code to use if validation fails.
 java.lang.String message
          Literal message to use if validation fails.
 java.lang.String messageKey
          Message key to use if validation fails.
 java.lang.String value
          Pattern to use when parsing the data, if it is not natively numeric
 

value

public abstract java.lang.String value
Pattern to use when parsing the data, if it is not natively numeric

Returns:
Pattern to use when parsing the data, if it is not natively numeric
Default:
""

defaultValue

public abstract java.lang.String defaultValue
If set to something different than the default (the empty string), specifies a default value that is used whenever a null value is received. The default value is parsed to a BigDecimal. Unlike IsDate and similar annotations, the default value does NOT go through the pattern parser, in order to avoid dependancies with different locales (Since, unlike dates, some fundamental symbols in the pattern are not literal - like decimal and thousands separators)

Returns:
Default value
Default:
""

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"