users@glassfish.java.net

Re: _at_Email not available in javax.validation.constraints ...

From: Nandini Ektare <Nandini.Ektare_at_Sun.COM>
Date: Mon, 26 Oct 2009 13:24:31 -0700

Hi,

Felipe Gaścho wrote:
> is @Email available in the javax.validation.constraints package ??
>
I don't see it as a standard constraint in Bean validation API which is
what GFv3's configuration adheres to (Hibernate however has a custom one
in their impl - org.hibernate.validator.constraints.Email) .
> if yes, how to use it ?
>
If you wan't to avoid using hibernate's impl, it will have to be a
custom constraint. Please see JSR 303 spec guidelines/examples to create
a new annotation (it's pretty straightforward).
> what maven dependency should I use to have this constraint available ?
>
Depending on where you intend to use that annotation, you may have to
use this dependency:
      <dependency>
            <groupId>org.glassfish</groupId>
            <artifactId>bean-validator</artifactId>
            <version>3.0-JBoss-4.0.1_01</version>
        </dependency>

Modules that already have dependency on hk2 config (such as
v3/admin/config-api) already have this dependency included transitively.
In that case, you would only need to make sure that the custom classes
are available to the module

Nandini
> can I use it only with JSF 2 or also with the java ee ManagedBean ?
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>
>