Java Mailing List Archive

http://www.gg3721.com/

Home » Hibernate Dev List »

Re: [hibernate-dev] Annotation Processor for HV

Emmanuel Bernard

2009-12-04

Replies: Find Java Web Hosting

Author LoginPost Reply

On 3 déc. 09, at 23:09, Gunnar Morling wrote:

> 2009/12/3 Emmanuel Bernard <emmanuel@(protected)>
> For sole determination of allowed types for constraint annotations
> you wouldn't need any validator implementations (or HV core) on the
> AP classpath when working with the mirror API, just BV API and the
> AP itself.
>
> You do. Otherwise how do you make custom constraint work?
>
> Actually not. From an element annotated with a constraint annotation
> you can
> - get the annotation mirrors
> - filter on those annotated themselves with @Constraint
> - retrieve the element value with name "validatedBy"
> - retrieve the type mirrors contained
> - retrieve the value of the 2nd type argument and check the type of
> the annotated element against it

The classes referenced by the validatedBy *are* the validator classes
at least if by validator you mean ConstraintVaildator implementation
of the custom constraint, so they have to be in the classpath to be
mirrored by the AP machinery :)
For built-in types it's a bit different as the @Constraint is not
filled up and has to be simulated.
_______________________________________________
hibernate-dev mailing list
hibernate-dev@(protected)
https://lists.jboss.org/mailman/listinfo/hibernate-dev
©2008 gg3721.com - Jax Systems, LLC, U.S.A.