It does only makes sense to have a type argument constraint if you have a container. What you're trying to do is basically: OK, I have a type T there and it might be used in methods, constructors, properties and I want a constraint on it. It doesn't really make sense. In your case, what you want is to declare your constraints on the properties of your beans, not on the type. It makes sense to add it on the type if the type defines some sort of container element. The exception you have is because you put a constraint on the type, you should remove it as it's not really a container. By the way, what you did works as expected: you declared a constraint on the type, then you created a value extractor that returns 2 values, one of them is null so you have a violation of the constraint. It's just that it's not what you want to do: what you really want to do is to declare constraints on the bean properties. |