Help

I have recently posted about the ability to use Bean Validation with various presentation technologies (here and there). Now Flex is part of the family. The good guys at GraniteDS have added support for Bean Validation into their project and hence Bean Validation is usable by all Flex users.

The work was not as straightforward as for JSF, Wicket or other Java technologies. Because they do not run on the JVM, they basically have reimplemented the full specification in Flex:

  • you can annotate your ActionScript3 objects with constraints: it supports all the standard constraints and you can write your own constraints
  • you can execute the validation logic and retrieve the error report
  • you can make use of most of the feature including advanced ones like groups, group sequence etc

And just like we did with JSF 2 and Bean Validation, the Flex forms do transparently call the constraints based on your domain model. What's also interesting for GraniteDS users keeping their Java domain model and ActionScript3 domain model in sync via Gas3, the constraints are kept in sync.

There are a couple of gotchas to be aware of. The port is not a one-to-one copy: some interfaces or design choice did not make sense due to how ActionScript3 works but overall this is a very close port

  • the constraint implementation is in the same class as the constraint declaration (not a problem in a dynamic language)
  • @Pattern has a sightly different semantic because the regexp engine in Flex is a bit different.
  • instead of the features provided by ConstraintValidatorContext, you can define a properties attribute in your constraints to make it belong to several sub-properties. not as flexible but good enough in many cases.
  • and maybe a few other things

Anyways, I won't talk to Franck until he has a 100% compliant implementation of the spec ;) Actually, I've got one real RFE: the documentation for this new validation module is part of the 'Advanced AS3 Features' chapter. I think this feature is simple enough and useful enough to warrant a better place.

To get the full documentation, check it out here. This is all part of the upcoming 2.2 version of GraniteDS.

PS: GraniteDS 2.2 also provides a full implementation of arbitrary-precision numbers, something that is surprisingly lacking from the Flex platform. So if you use Flex and are in banks or any other number crunching industry, check out their BigInteger and BigDecimal implementation.

6 comments:
 
24. Jun 2014, 11:56 CET | Link

However, Forex quotes are not stated as a single price. In any Forex quotes , two sets of prices are given, representing the price at which the broker or dealer will buy a currency from a trader who wants to sell, and the price at which dealer or broker will sell to a forex trader who wants to buy However, even though the market is considered a 24-hour market, its important to know when the forex market hours is actually active and when is the best time to place a trade on the market.

ReplyQuote
 
29. Aug 2014, 06:10 CET | Link
obat herbal kanker prostat

Click HELP for text formatting instructions. Then edit this text and check the preview. obat herbal kanker prostat

 
18. Sep 2014, 13:46 CET | Link

Pour la plupart des enfants, oméga aiguë ou grave replique montres douleur stylo réplique de Breitling est procédures invasives telles que raison d'une blessure ou d'une opération.

 
26. Sep 2014, 09:29 CET | Link
obat jantung bengkak

Penjualan Obat Herbal Penyakit Jantung Bengkak - obat jantung bengkak tradisional

 
20. Oct 2014, 12:57 CET | Link
hule

Click HEL This is a great article thanks for sharing this informative information. HD mxf files conversion software mxf converter pdf conversion to Office pdf to word

 
31. Oct 2014, 10:44 CET | Link
mano

The greatest interest of your ease is actul perception moreover salubrious network. It reminded me whereas I permit written custom essay service besides how gravely it was to discover improve expedients. Appears to me want you didn't retain such syndrome.

Post Comment