com.planetalia.dynject.validation
Annotation Type IsBoolean


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

Requires that the annotated element be a boolean value. If the value received is not directly a boolean, it attempts a conversion using either predefined or specified patterns.

Author:
Alexander Hristov

Optional Element Summary
 java.lang.String errorCode
          Error code to use if validation fails.
 java.lang.String falsePattern
          Pattern representing the possible values that are interpreted as "false"
 java.lang.String message
          Literal message to use if validation fails.
 java.lang.String messageKey
          Message key to use if validation fails.
 boolean notFalseMeansTrue
          If set to true, only the "false" pattern is checked, and if it doesn't match, the value is assumed to be true automatically regardless of whether it matches the true pattern.
 boolean notTrueMeansFalse
          If set to true, only the "true" pattern is checked, and if it doesn't match, the value is assumed to be false automatically regardless of whether it matches the false pattern.
 java.lang.String truePattern
          Pattern representing the possible values that are interpreted as "true"
 

truePattern

public abstract java.lang.String truePattern
Pattern representing the possible values that are interpreted as "true"

Returns:
Pattern representing the possible values that are interpreted as "true"
Default:
"(true)|(yes)|(1(\\.0+)?)"

falsePattern

public abstract java.lang.String falsePattern
Pattern representing the possible values that are interpreted as "false"

Returns:
Pattern representing the possible values that are interpreted as "false"
Default:
"(false)|(no)|(0(\\.0+)?)"

notTrueMeansFalse

public abstract boolean notTrueMeansFalse
If set to true, only the "true" pattern is checked, and if it doesn't match, the value is assumed to be false automatically regardless of whether it matches the false pattern. Note that if set to true, this annotation will never cause a validation error.

Returns:
True to omit matching the value with the "false" pattern
Default:
false

notFalseMeansTrue

public abstract boolean notFalseMeansTrue
If set to true, only the "false" pattern is checked, and if it doesn't match, the value is assumed to be true automatically regardless of whether it matches the true pattern. Note that if set to true, this annotation will never cause a validation error.

Returns:
True to omit matching the value with the "true" pattern
Default:
false

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"