| Package | org.granite.validation.constraints |
| Class | public class Pattern |
| Inheritance | Pattern BaseConstraint |
javax.validation.constraints.Pattern annotation
validator.
The annotated String must match the supplied regular expression.
Accepted arguments are:
String that specifies the
payloads with which the constraint declaration is associated (unlike the Java
implementation, payloads are arbitrary Strings and does not represent
necessarily existing class names).Stringnull elements are considered valid.
Example:
[Pattern(message="{my.custom.message}", groups="path.to.MyGroup1, path.to.MyGroup2", regexp="[a-z]+", flags="CASE_INSENSITIVE, DOTALL")]
public function get property():String {
...
}") in argument values must be escaped
by using the XML entity (").&) in argument values should be escaped by
using the XML entity (&).<) characters in argument values
must be escaped by using the XML entity (<). All "greater than"
(>) characters in argument values should be escaped by using the XML entity
(>)&space;) in order to keep leading or trailing white spaces in literals.groups)
may use the pseudo XML entity (,) in order to keep comma characters
in literals.| Property | Defined by | ||
|---|---|---|---|
![]() | factory : ValidatorFactory
The
ValidatorFactory passed to the initialized
function. | BaseConstraint | |
| flags : Array [read-only]
The array of flags considered when resolving the regular expression.
| Pattern | ||
![]() | groups : Array
The processing groups with which this constraint is associated as
an array of
Class. | BaseConstraint | |
![]() | message : String
The error message associated with this constraint.
| BaseConstraint | |
![]() | payload : Array
The payload with which this constraint is associated as
an array of
String. | BaseConstraint | |
![]() | properties : Array
The properties with which this constraint is associated as
an array of
String (only for class-level constraints that
deal with one or more properties, in order to figure out where error
messages should be displayed when this constraint fails). | BaseConstraint | |
| regexp : String [read-only]
The regular expression to match.
| Pattern | ||
| Method | Defined by | ||
|---|---|---|---|
|
Initialize this constraint, according to the supplied annotation
parameters.
| Pattern | ||
|
validate(value:*):String
Validate the
value parameter, according to this
constraint specification. | Pattern | ||
| Constant | Defined by | ||
|---|---|---|---|
| CASE_INSENSITIVE : String = "CASE_INSENSITIVE" [static]
Enables case-insensitive matching (see
java.util.regex.Pattern#CASE_INSENSITIVE). | Pattern | ||
| DEFAULT_MESSAGE : String = "{javax.validation.constraints.Pattern.message}" [static]
The default message key of this constraint.
| Pattern | ||
| DOTALL : String = "DOTALL" [static]
Enables dotall mode (see
java.util.regex.Pattern#DOTALL). | Pattern | ||
| MULTILINE : String = "MULTILINE" [static]
Enables multiline mode (see
java.util.regex.Pattern#MULTILINE). | Pattern | ||
| flags | property |
flags:Array [read-only]The array of flags considered when resolving the regular expression.
Implementation public function get flags():Array
See also
| regexp | property |
regexp:String [read-only]The regular expression to match.
Implementation public function get regexp():String
| initialize | () | method |
public override function initialize(annotation:Annotation, factory:ValidatorFactory):void
Initialize this constraint, according to the supplied annotation
parameters.
The org.granite.validation.BaseConstraint
implementation of this method throws an Error
and must be overridden in inherited classes.
annotation:Annotation — the anntotation defining this constraint.
|
|
factory:ValidatorFactory |
| validate | () | method |
public override function validate(value:*):String
Validate the value parameter, according to this
constraint specification.
The org.granite.validation.BaseConstraint
implementation of this method throws an Error
and must be overridden in inherited classes.
value:* — the value to be validated.
|
String — null if the supplied value is valid, an error
message key otherwise.
|
| CASE_INSENSITIVE | constant |
public static const CASE_INSENSITIVE:String = "CASE_INSENSITIVE"
Enables case-insensitive matching (see
java.util.regex.Pattern#CASE_INSENSITIVE).
| DEFAULT_MESSAGE | constant |
public static const DEFAULT_MESSAGE:String = "{javax.validation.constraints.Pattern.message}"The default message key of this constraint.
| DOTALL | constant |
public static const DOTALL:String = "DOTALL"
Enables dotall mode (see
java.util.regex.Pattern#DOTALL).
| MULTILINE | constant |
public static const MULTILINE:String = "MULTILINE"
Enables multiline mode (see
java.util.regex.Pattern#MULTILINE).