Packageorg.granite.validation.constraints
Classpublic class Pattern
InheritancePattern Inheritance BaseConstraint

The ActionsScript3 implementation of the javax.validation.constraints.Pattern annotation validator.

The annotated String must match the supplied regular expression.

Accepted arguments are:

Supported types are: null 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 {
      ...
  }
General notes on escaping:



Public Properties
 PropertyDefined by
 Inheritedfactory : ValidatorFactory
The ValidatorFactory passed to the initialized function.
BaseConstraint
  flags : Array
[read-only] The array of flags considered when resolving the regular expression.
Pattern
 Inheritedgroups : Array
The processing groups with which this constraint is associated as an array of Class.
BaseConstraint
 Inheritedmessage : String
The error message associated with this constraint.
BaseConstraint
 Inheritedpayload : Array
The payload with which this constraint is associated as an array of String.
BaseConstraint
 Inheritedproperties : 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
Protected Properties
 PropertyDefined by
 Inherited_factory : ValidatorFactory
Direct access (protected) to the ValidatorFactory instance passed to the initialized function.
BaseConstraint
 Inherited_groups : Array
Direct access (protected) to the groups defined for this constraint.
BaseConstraint
 Inherited_message : String
Direct access (protected) to the message key defined for this constraint.
BaseConstraint
 Inherited_payload : Array
Direct access (protected) to the payload defined for this constraint.
BaseConstraint
 Inherited_properties : Array
Direct access (protected) to the properties defined for this constraint.
BaseConstraint
Public Methods
 MethodDefined by
  
initialize(annotation:Annotation, factory:ValidatorFactory):void
Initialize this constraint, according to the supplied annotation parameters.
Pattern
  
validate(value:*):String
Validate the value parameter, according to this constraint specification.
Pattern
Protected Methods
 MethodDefined by
 Inherited
[static] Creates a definition of the standard message annotation argument with the supplied string.
BaseConstraint
 Inherited
internalInitialize(factory:ValidatorFactory, annotation:Annotation, defaultMessage:String, parameterDefinitions:Array = null):Dictionary
Parse constraint parameters according to the annotation arguments, initialize the message, groups and payload properties and return a Dictionary that contains all parsed values.
BaseConstraint
Public Constants
 ConstantDefined 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
Protected Constants
 ConstantDefined by
 InheritedBOOLEAN_TYPES : Array
[static] An array of boolean types: [Boolean] (used when checking the value type of a constraint annotation argument).
BaseConstraint
 InheritedDATE_TYPES : Array
[static] An array of date types: [Date] (used when checking the value type of a constraint annotation argument).
BaseConstraint
 InheritedGROUPS_PARAMETER : ParameterDefinition
[static] The definition of the standard groups constraint annotation argument, as an optional array of Class names.
BaseConstraint
 InheritedNUMBER_STRING_TYPES : Array
[static] An array of numeric or string types: [BigDecimal, BigInteger, Long, Number, int, uint String] (used when checking the value type of a constraint annotation argument).
BaseConstraint
 InheritedPAYLOAD_PARAMETER : ParameterDefinition
[static] The definition of the standard payload constraint annotation argument, as an optional array of Strings.
BaseConstraint
 InheritedPROPERTIES_PARAMETER : ParameterDefinition
[static] The definition of the standard properties constraint annotation argument, as an optional array of Strings.
BaseConstraint
 InheritedSTRING_TYPES : Array
[static] An array of string types: [String] (used when checking the value type of a constraint annotation argument).
BaseConstraint
Property detail
flagsproperty
flags:Array  [read-only]

The array of flags considered when resolving the regular expression.

Implementation
    public function get flags():Array

See also

regexpproperty 
regexp:String  [read-only]

The regular expression to match.

Implementation
    public function get regexp():String
Method detail
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.

Parameters
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.

Parameters
value:* — the value to be validated.

Returns
Stringnull if the supplied value is valid, an error message key otherwise.
Constant detail
CASE_INSENSITIVEconstant
public static const CASE_INSENSITIVE:String = "CASE_INSENSITIVE"

Enables case-insensitive matching (see java.util.regex.Pattern#CASE_INSENSITIVE).

DEFAULT_MESSAGEconstant 
public static const DEFAULT_MESSAGE:String = "{javax.validation.constraints.Pattern.message}"

The default message key of this constraint.

DOTALLconstant 
public static const DOTALL:String = "DOTALL"

Enables dotall mode (see java.util.regex.Pattern#DOTALL).

MULTILINEconstant 
public static const MULTILINE:String = "MULTILINE"

Enables multiline mode (see java.util.regex.Pattern#MULTILINE).