Hi all, You can find my code here http://people.apache.org/~rdebusscher/parameterValidation_POC.zip
Regards Rudy. On 23 November 2010 13:58, Rudy De Busscher <rdebussc...@gmail.com> wrote: > I'll clean up the code a bit and try to post it here on thursday. > > regards > Rudy. > > > On 22 November 2010 22:24, Gerhard <gerhard.petra...@gmail.com> wrote: > >> hi, >> >> -1 >> we would only have disadvantages with such a dependency between both >> frameworks. >> >> since we have a bv module in codi for bv artifacts which are enhanced via >> cdi mechanisms - we should implement it there. >> >> regards, >> gerhard >> >> http://www.irian.at >> >> Your JSF powerhouse - >> JSF Consulting, Development and >> Courses in English and German >> >> Professional Support for Apache MyFaces >> >> >> >> 2010/11/22 Jakob Korherr <jakob.korh...@gmail.com> >> >>> ... sorry.. I meant "CODI and ext-val". >>> >>> 2010/11/22 Jakob Korherr <jakob.korh...@gmail.com> >>> >>> Hi Rudy, >>>> >>>> Nice idea! >>>> >>>> If we don't want to put it directly into CODI, we could create a CODI >>>> add-on for it in ext-val, because CODI and ext-cdi kinda overlap here. >>>> >>>> Regards, >>>> Jakob >>>> >>>> 2010/11/22 Gerhard <gerhard.petra...@gmail.com> >>>> >>>> hi rudy, >>>>> >>>>> basically it's a nice idea. >>>>> for further discussions we would need your implementation. >>>>> >>>>> regards, >>>>> gerhard >>>>> >>>>> http://www.irian.at >>>>> >>>>> Your JSF powerhouse - >>>>> JSF Consulting, Development and >>>>> Courses in English and German >>>>> >>>>> Professional Support for Apache MyFaces >>>>> >>>>> >>>>> >>>>> 2010/11/22 Rudy De Busscher <rdebussc...@gmail.com> >>>>> >>>>> Hi all, >>>>>> >>>>>> BeanValidation is promoted as *THE validation framework* in the EE >>>>>> environment. it can already be used in JPA and JSF. In the future they >>>>>> plan to have it also in other areas like JAX-RS. >>>>>> >>>>>> Another area where we could start using it, is with CDI. With the >>>>>> creation of an Interceptor, it is possible to develop a mechanism that >>>>>> allow >>>>>> validation of method parameter values. >>>>>> >>>>>> Aparently Apache BVal is taking this up (thx Gerhard for the input, >>>>>> see here >>>>>> http://carinae.net/2010/04/automatic-validation-method-calls-with-jsr-303-appendix-c/), >>>>>> but a generic solution could be made available in Codi. Since there is >>>>>> no method forseen in the BeanValidation spec to validate a value based >>>>>> on an >>>>>> annotation (only methods for validating a property within a class or a >>>>>> complete object), I was forced to create a hack with dynamically created >>>>>> classes. >>>>>> >>>>>> But in a POC I was able to use the following declarations >>>>>> >>>>>> * @ParameterValidation >>>>>> public String sayHelloMinimumLength(@Size(min = 3) String name) { >>>>>> return "Hello "+name; >>>>>> } >>>>>> >>>>>> @ParameterValidation >>>>>> public String sayHello(@NotNull @Valid Person person) { >>>>>> return "Hello "+person.getLastName(); >>>>>> }* >>>>>> >>>>>> And I did some small (but successful) tests in the following >>>>>> environments >>>>>> - Plain SE (JUnit tests) >>>>>> - Tomcat 6 >>>>>> - JBoss 6 (M5) >>>>>> >>>>>> The performance is also acceptable. Executing 1000 tests on the >>>>>> sayHelloMinimumLength method as described above, adds about 300 ms (in >>>>>> total, so 0.3 ms per call). >>>>>> >>>>>> So with this message I would like to have the opinion of the community >>>>>> about adding such functionality to Codi. I think we have 3 options: >>>>>> >>>>>> 1) Add it to Codi itself (I think the BV module is the best candidate) >>>>>> 2) Put the logic in an add-on because it is useful but not all >>>>>> projects can/will use it. >>>>>> 3) Spend our time to other topics because it is useless. [?] >>>>>> >>>>>> If you like the idea, I do some further work on the code an supply a >>>>>> patch or the add-on. >>>>>> >>>>>> Regards >>>>>> Rudy. >>>>>> >>>>>> >>>>> >>>> >>>> >>>> -- >>>> Jakob Korherr >>>> >>>> blog: http://www.jakobk.com >>>> twitter: http://twitter.com/jakobkorherr >>>> work: http://www.irian.at >>>> >>> >>> >>> >>> -- >>> Jakob Korherr >>> >>> blog: http://www.jakobk.com >>> twitter: http://twitter.com/jakobkorherr >>> work: http://www.irian.at >>> >> >> >
<<330.png>>