| Package | org.granite.validation |
| Class | public class BaseConstraint |
| Implements | IConstraint |
| Subclasses | AssertFalse, AssertTrue, DecimalMax, DecimalMin, Digits, Future, Max, Min, NotNull, Null, Past, Pattern, Size |
IConstraint implementations.
See standard constraint implementations for usage.
| Property | Defined by | ||
|---|---|---|---|
| factory : ValidatorFactory
[read-only]
The
ValidatorFactory passed to the initialized
function. | BaseConstraint | ||
| groups : Array [read-only]
The processing groups with which this constraint is associated as
an array of
Class. | BaseConstraint | ||
| message : String [read-only]
The error message associated with this constraint.
| BaseConstraint | ||
| payload : Array [read-only]
The payload with which this constraint is associated as
an array of
String. | BaseConstraint | ||
| properties : Array [read-only]
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 | ||
| Property | Defined by | ||
|---|---|---|---|
| _factory : ValidatorFactory
Direct access (protected) to the
ValidatorFactory
instance passed to the initialized function. | BaseConstraint | ||
| _groups : Array
Direct access (protected) to the groups defined for this
constraint.
| BaseConstraint | ||
| _message : String
Direct access (protected) to the message key defined for this
constraint.
| BaseConstraint | ||
| _payload : Array
Direct access (protected) to the payload defined for this
constraint.
| BaseConstraint | ||
| _properties : Array
Direct access (protected) to the properties defined for this
constraint.
| BaseConstraint | ||
| Method | Defined by | ||
|---|---|---|---|
|
Initialize this constraint, according to the supplied annotation
parameters.
| BaseConstraint | ||
|
validate(value:*):String
Validate the
value parameter, according to this
constraint specification. | BaseConstraint | ||
| Method | Defined by | ||
|---|---|---|---|
|
createMessageParameter(message:String):ParameterDefinition
[static]
Creates a definition of the standard
message annotation
argument with the supplied string. | BaseConstraint | ||
|
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 | ||
| Constant | Defined by | ||
|---|---|---|---|
| BOOLEAN_TYPES : Array [static]
An array of boolean types:
[Boolean] (used when checking
the value type of a constraint annotation argument). | BaseConstraint | ||
| DATE_TYPES : Array [static]
An array of date types:
[Date] (used when checking
the value type of a constraint annotation argument). | BaseConstraint | ||
| GROUPS_PARAMETER : ParameterDefinition
[static]
The definition of the standard
groups constraint annotation
argument, as an optional array of Class names. | BaseConstraint | ||
| NUMBER_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 | ||
| PAYLOAD_PARAMETER : ParameterDefinition
[static]
The definition of the standard
payload constraint annotation
argument, as an optional array of Strings. | BaseConstraint | ||
| PROPERTIES_PARAMETER : ParameterDefinition
[static]
The definition of the standard
properties constraint annotation
argument, as an optional array of Strings. | BaseConstraint | ||
| STRING_TYPES : Array [static]
An array of string types:
[String] (used when checking
the value type of a constraint annotation argument). | BaseConstraint | ||
| _factory | property |
protected var _factory:ValidatorFactory
Direct access (protected) to the ValidatorFactory
instance passed to the initialized function.
See also
| factory | property |
factory:ValidatorFactory [read-only]
The ValidatorFactory passed to the initialized
function.
public function get factory():ValidatorFactory
| _groups | property |
protected var _groups:ArrayDirect access (protected) to the groups defined for this constraint.
See also
| groups | property |
groups:Array [read-only]
The processing groups with which this constraint is associated as
an array of Class.
public function get groups():Array
| _message | property |
protected var _message:StringDirect access (protected) to the message key defined for this constraint.
See also
| message | property |
message:String [read-only]The error message associated with this constraint.
Implementation public function get message():String
| _payload | property |
protected var _payload:ArrayDirect access (protected) to the payload defined for this constraint.
See also
| payload | property |
payload:Array [read-only]
The payload with which this constraint is associated as
an array of String.
public function get payload():Array
| _properties | property |
protected var _properties:ArrayDirect access (protected) to the properties defined for this constraint.
See also
| properties | property |
properties:Array [read-only]
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).
public function get properties():Array
| createMessageParameter | () | method |
protected static function createMessageParameter(message:String):ParameterDefinition
Creates a definition of the standard message annotation
argument with the supplied string.
message:String — the message key used in the returned message
ParameterDefinition.
|
ParameterDefinition —
a new ParameterDefinition for the standard
message constraint annotation argument.
|
| initialize | () | method |
public 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 |
| internalInitialize | () | method |
protected function 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.
factory:ValidatorFactory — the constraint annotation with its arguments.
|
|
annotation:Annotation — the default error message for this constraint.
|
|
defaultMessage:String — an array of ParameterDefinition
that contains specific argument definitions for this constraint
(excluding message, groups and payload).
|
|
parameterDefinitions:Array (default = null) |
Dictionary — a Dictionary with parsed arguments.
|
ConstraintDefinitionError — if a required
argument is missing, if an argument value isn't of the expected
type or if an unknown argument is present.
|
| validate | () | method |
public 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.
|
| BOOLEAN_TYPES | constant |
protected static const BOOLEAN_TYPES:Array
An array of boolean types: [Boolean] (used when checking
the value type of a constraint annotation argument).
See also
| DATE_TYPES | constant |
protected static const DATE_TYPES:Array
An array of date types: [Date] (used when checking
the value type of a constraint annotation argument).
See also
| GROUPS_PARAMETER | constant |
protected static const GROUPS_PARAMETER:ParameterDefinition
The definition of the standard groups constraint annotation
argument, as an optional array of Class names.
| NUMBER_STRING_TYPES | constant |
protected static const NUMBER_STRING_TYPES:Array
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).
See also
| PAYLOAD_PARAMETER | constant |
protected static const PAYLOAD_PARAMETER:ParameterDefinition
The definition of the standard payload constraint annotation
argument, as an optional array of Strings.
| PROPERTIES_PARAMETER | constant |
protected static const PROPERTIES_PARAMETER:ParameterDefinition
The definition of the standard properties constraint annotation
argument, as an optional array of Strings.
| STRING_TYPES | constant |
protected static const STRING_TYPES:Array
An array of string types: [String] (used when checking
the value type of a constraint annotation argument).
See also