[bv-dev] Value extraction open issue #9: extractors for specific parameterized types

Gunnar Morling gunnar at hibernate.org
Mon Jan 16 10:35:21 EST 2017


Hi,

Another one from the open issues list: Should we allow extractors to
be defined for specific parameterized types, e.g.:

    public class ListOfIntegerExtractor implements
ValueExtractor<List<@ExtractedValue Integer>> { ... }

    public class ListOfStringExtractor implements
ValueExtractor<List<@ExtractedValue String>> { ... }

Currently, a value extractor may only mark a wild-card type parameter
with @ExtractedValue:

    public class ListOfStringExtractor implements
ValueExtractor<List<@ExtractedValue ?>> { ... }

The reason being to cut down on complexity and the lack of any use
case. Is there any scenario where one would want to extract a list of
Integer differently than a list String?

I would thus only support wildcard type parameters in extractor
definitions, unless someone else can see a compelling use case for the
more liberal model. Note we always can relax the requirement in a
future revision.

Thanks,

--Gunnar


More information about the beanvalidation-dev mailing list