myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <wikidi...@apache.org>
Subject [Myfaces Wiki] Update of "Extensions/Validator/ConceptOverview/Constraint Aspects" by GerhardPetracek
Date Tue, 09 Jun 2009 21:38:10 GMT
Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Myfaces Wiki" for change notification.

The following page has been changed by GerhardPetracek:
http://wiki.apache.org/myfaces/Extensions/Validator/ConceptOverview/Constraint_Aspects

------------------------------------------------------------------------------
  }
  }}}
  
+ === Parameter implementation - style 4 ===
+ Class with implicit key + the implementation provides the final value (the method isn't
given by the interface)
+ (PropertyValidationInterceptor extends ValidationParameter)
+ 
+ {{{
+ public class CustomValidationInterceptor implements PropertyValidationInterceptor
+ {
+     private static PropertyValidationInterceptor propertyValidationInterceptor;
+ 
+     //called at every parameter query
+     @ParameterValue
+     public PropertyValidationInterceptor getInstance()
+     {
+         if(propertyValidationInterceptor == null)
+         {
+             propertyValidationInterceptor = new CustomValidationInterceptor();
+         }
+         return propertyValidationInterceptor;
+     }
+ 
+     public boolean beforeValidation(
+             FacesContext facesContext, UIComponent uiComponent, Object convertedObject,
Map<String, Object> properties)
+     {
+         //your implementation
+         return true;
+     }
+ 
+     public void afterValidation(
+             FacesContext facesContext, UIComponent uiComponent, Object convertedObject,
Map<String, Object> properties)
+     {
+         //your implementation
+     }
+ }
+ }}}
+ 
  === Using the constraint and these parameter implementations ===
  
  {{{
- @MyConstraint(params = {ViolationSeverity.Warn.class, AllowClientSideValidation.class, HighPriority.class})
+ @MyConstraint(params = {ViolationSeverity.Warn.class, AllowClientSideValidation.class, HighPriority.class,
CustomValidationInterceptor.class})
  }}}
  
  === Query the information ===

Mime
View raw message