| Package | org.granite.validation.constraints |
| Class | public class Size |
| Inheritance | Size BaseConstraint |
javax.validation.constraints.Size annotation
validator.
The annotated element size must be between the specified boundaries
(included).
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).0).int.MAX_VALUE.StringArrayVectorDictionaryIList implementators (such as ArrayCollection)org.granite.collection.IMap implementators)null elements are considered valid.
Example:
[Size(message="{my.custom.message}", groups="path.to.MyGroup1, path.to.MyGroup2", min="2", max="10")]
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 | |
![]() | groups : Array
The processing groups with which this constraint is associated as
an array of
Class. | BaseConstraint | |
| max : int [read-only]
The maximum size as specified in the annotation arguments.
| Size | ||
![]() | message : String
The error message associated with this constraint.
| BaseConstraint | |
| min : int [read-only]
The minimum size as specified in the annotation arguments.
| Size | ||
![]() | 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 | |
| Method | Defined by | ||
|---|---|---|---|
|
Initialize this constraint, according to the supplied annotation
parameters.
| Size | ||
|
validate(value:*):String
Validate the
value parameter, according to this
constraint specification. | Size | ||
| Constant | Defined by | ||
|---|---|---|---|
| DEFAULT_MESSAGE : String = "{javax.validation.constraints.Size.message}" [static]
The default message key of this constraint.
| Size | ||
| max | property |
max:int [read-only]The maximum size as specified in the annotation arguments.
Implementation public function get max():int
| min | property |
min:int [read-only]The minimum size as specified in the annotation arguments.
Implementation public function get min():int
| 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.
|
| DEFAULT_MESSAGE | constant |
public static const DEFAULT_MESSAGE:String = "{javax.validation.constraints.Size.message}"The default message key of this constraint.