camel-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Christian Mueller (JIRA)" <>
Subject [jira] Updated: (CAMEL-2565) Create a new camel-bean-validation component (based on JSR 303)
Date Sat, 10 Apr 2010 15:14:43 GMT


Christian Mueller updated CAMEL-2565:

    Attachment: CAMEL-2565.patch

Claus, I attached a new patch file which only contains changes for this component. Sorry for
the last faulty patch.

Answers to your questions:
1) validator.xml in META-INF is not required. It's only needed and required, if you want define
your constraints via XML and not with annotations (more [here|]).
All settings shown in the validation.xml are optional.

2) An enum make no sense. This parameter is the full qualified name of an interface which
the user has to develop (only a marker interface). This class name is than used in the annotated
bean as group name (Annotation without an explicit group name belongs implicit to the group
    @Size(min = 5, max = 14, groups = OptionalChecks.class)
    private String licensePlate;

is equal to 

    @NotNull(groups = Default.class)
    @Size(min = 5, max = 14, groups = OptionalChecks.class)
    private String licensePlate;

This group name (or group names) are provided to the validate method. The validator only checks
constraints for this group (or this groups).

Set<ConstraintViolation<Object>> constraintViolations = validator.validate(bean,

To keep things simple, the user can only define one group in this camel component. If this
component should check constraints from more than one group, the user has to define a new
marker interface like this:

@GroupSequence({Default.class, OptionalChecks.class})
public interface OrderedChecks {

and use OrderedChecks as group name. This checks all constraints within the group Default
(or without a group) and OptionalChecks.
Another possibility for the user is to annotate the bean to redefine the default group (more

@GroupSequence({ Default.class, OptionalChecks.class })
public class  Car {

For the last choice, I still have to write a unit test... :-)

> Create a new camel-bean-validation component (based on JSR 303)
> ---------------------------------------------------------------
>                 Key: CAMEL-2565
>                 URL:
>             Project: Apache Camel
>          Issue Type: New Feature
>         Environment: All
>            Reporter: Christian Mueller
>            Assignee: Christian Mueller
>             Fix For: 2.3.0
>         Attachments: CAMEL-2565.patch, CAMEL-2565.patch
> We want provide a validation component for java beans (POJOs) based on [JSR 303|].
We want to use the reference implementation, which is [Hibernate Validator|].
> The Hibernate Validator (the reference implementation for JSR 303) is licensed under
the Apache License Version 2:
 but not published as an OSGI bundle. So, I opened the issue [SMX4-506]]
to provide an OSGI bundle for that library.
> Please have a look into [Nabble|]
for details.

This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators:
For more information on JIRA, see:


View raw message