| Package | org.granite.validation |
| Class | public class ValidationMessages |
| Inheritance | ValidationMessages InternalBundle |
ValidationMessages class is responsible of loading standard
validation resources bundles. Three language are provided by default: english,
french, german (as in the JSR-303 default implementation) and chinese.
The name of this bundle is "ValidationMessages", add it is possible to override default resources or to add new ones programatically (see Flex documentation). Here is a sample of such an override and addition (here at runtime):
var validationBundle:ResourceBundle = new ResourceBundle("en_US", ValidationMessages.NAME);
// override of the default Size message ("size must be between {min} and {max}").
validationBundle.content["javax.validation.constraints.Size.message"] = "Size should be in [{min}, {max}]";
// add a new message.
validationBundle.content["my.validation.SpecialConstraint.message"] = "Value must be special";
ResourceManager.getInstance().addResourceBundle(validationBundle);
ResourceManager.getInstance().update();
ResourceManager.getInstance().localeChain = ["en_US"];
See also
| Method | Defined by | ||
|---|---|---|---|
|
[static]
Returns a unique instance of the
ValidationMessages class. | ValidationMessages | ||
![]() |
getString(resourceName:String, parameters:Array = null, locale:String = null):String
Look for a resource named
resourceName in the loaded Flex application
bundles (with the bundle name provided at creation time) and, if it cannot be found,
look for it in this internal bundle properties. | InternalBundle | |
| Constant | Defined by | ||
|---|---|---|---|
| NAME : String = "ValidationMessages" [static]
A constant defining the name of the validation resource bundle.
| ValidationMessages | ||
| getInstance | () | method |
public static function getInstance():ValidationMessages
Returns a unique instance of the ValidationMessages class.
ValidationMessages —
a unique instance of the ValidationMessages class.
|
| NAME | constant |
public static const NAME:String = "ValidationMessages"A constant defining the name of the validation resource bundle.