Sunday, September 27, 2009

myfaces-extval MetaDataStorageFilter and @JoinValidation

beside some other improvements a new concept will be available with the next milestone.

a generic storage concept is used to cache the basic meta-data.
all mechanisms which allow dynamic meta-data remain the same. instead of caching the final meta-data for a property just the basic meta-data gets cached. the meta-data which is extracted from the original property. as an addition to the existing dynamic meta-data mechanisms a new concept is available. in comparison to a MetaDataExtractionInterceptor the new MetaDataStorageFilter is just invoked before meta-data gets added to the storage.

it's an additional extension point which allows you e.g. to introduce new functionality which isn't available out of the box.
the property-validation module of extval uses such a filter to introduce a new syntax for @JoinValidation. so it's possible to use a static syntax instead of the dynamic possibilities.

some nice syntax examples are available at one of the example classes.

so maybe you ask - MetaDataStorageFilter are fine but all i need is already possible via a MetaDataExtractionInterceptor. why do i need such filters? yes that's right, however, the new filter concept in combination with the meta-data-storage allow a better performance.

MetaDataExtractionInterceptor ... use them if you have to decide to add/remove/change meta-data very dynamically - e.g. based on the current program-flow, app-state,...

MetaDataStorageFilter ... use them if you would like to introduce a custom but static concept and benefit from the better performance