I would like something like Java in Java and don't know what to look for:
public interface Subject<T> { } public interface EMailAddress extends Subject<String> { } public interface Validator<T extends Subject<V>> { Set<InputErrors> validate(final V thing);
Basically, I would like the Validator # validate parameter type to be the same as the generic Subject type.
I could write it like this:
public interface Validator<A,B extends Subject<A>> { Set<InputErrors> validate(final A thing); }
But that would require me to declare instances that look verbose
private Validator<String,EMailAddress> validator;
msung source share