Skip to content

Instantly share code, notes, and snippets.

@gunnarmorling
Last active November 25, 2016 17:04
Show Gist options
  • Save gunnarmorling/8ba0502c2772459186b5569863f45745 to your computer and use it in GitHub Desktop.
Save gunnarmorling/8ba0502c2772459186b5569863f45745 to your computer and use it in GitHub Desktop.
// Should we reject it?
public class DoubleExtractor implements ValueExtractor<Multimap<@ExtractedValue ?, @ExtractedValue ?>> {
@Override
public void extractValues(Multimap<?, ?> originalValue, ValueExtractor.ValueReceiver receiver) {
...
}
}
class ListValueExtractor implements ValueExtractor<List<@ExtractedValue ?>> {
...
}
class ArrayListValueExtractor implements ValueExtractor<ArrayList<@ExtractedValue ?>> {
...
}
// Which extractor should be applied? Constraint validator resolution is happening using the runtime type.
// Should the same be done for extractors? This wouldn't allow to cache it per usage, though.
private List<@Valid String> strings = new ArrayList<>();
interface SameTypeForKeyAndValueMap<T> extends Map<T, T> {}
private SameTypeForKeyAndValueMap<@Valid String> stringToStringMap = ...;
private Map<String, @Valid Integer> intsByString;
public get Map<@Valid String, Integer> getIntsByString() {
return intsByString;
}
@gunnarmorling
Copy link
Author

Some corner cases. What should happen in each of them?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment