You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by Apache Wiki <wi...@apache.org> on 2010/01/06 18:54:11 UTC

[Myfaces Wiki] Update of "Extensions/Validator/ValidateAnnotations" by GerhardPetracek

Dear Wiki user,

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

The "Extensions/Validator/ValidateAnnotations" page has been changed by GerhardPetracek.
http://wiki.apache.org/myfaces/Extensions/Validator/ValidateAnnotations?action=diff&rev1=4&rev2=5

--------------------------------------------------

  
  == Minimal implementation ==
  {{{
- //my.custom.package.CustomRequired
+ //my.custom.package.CustomConstraint
  
  @Target({METHOD, FIELD})
  @Retention(RUNTIME)
- public @interface CustomRequired
+ public @interface CustomConstraint
  {
  }
  
- //my.custom.package.CustomRequiredValidationStrategy
+ //my.custom.package.CustomConstraintValidationStrategy
- public class CustomRequiredValidationStrategy implements ValidationStrategy
+ public class CustomConstraintValidationStrategy implements ValidationStrategy
  {
      void validate(FacesContext facesContext, UIComponent uiComponent,
                    MetaDataEntry metaDataEntry, Object convertedObject)
@@ -39, +39 @@

  
  That's just the simplest case. You can also use one of the other available name conventions or you can provide a custom convention or a custom name mapper or ...
  
+ '''Hints'''<<BR>>
  It's '''recommended to use AbstractValidatorAdapter or AbstractAnnotationValidationStrategy''' instead of ValidationStrategy.
+ 
+ In ExtVal r3+ validation strategies don't have to be aware of empty/null values. So it's safe to delegate to legacy JSF validators.<<BR>>
+ If a validation strategy should validate such values, it's possible to annotate the validation strategy with NullValueAwareValidationStrategy and/or EmptyValueAwareValidationStrategy.
  
  == Existing annotations ==