Announcement Announcement Module
Collapse
No announcement yet.
Why the Validator interface is not generic in Spring 3.0 Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Why the Validator interface is not generic in Spring 3.0

    While reading the reference documentation of Spring 3.0 I found the Validator interface. And I wonder why this interface is not generic. Can any body tell my why?

  • #2
    Hello

    I am not an expert about patterns but in the Validator's API
    offer a method with some relation with generics

    Code:
    supports
    
    boolean supports(Class<?> clazz)
    
        Can this Validator validate instances of the supplied clazz?
    
        This method is typically implemented like so:
    
        return Foo.class.isAssignableFrom(clazz);
    
        (Where Foo is the class (or superclass) of the actual object instance that is to be validated.)
    
        Parameters:
            clazz - the Class that this Validator is being asked if it can validate 
        Returns:
            true if this Validator can indeed validate instances of the supplied clazz
    I think it is based for a reason about design patterns, I hope some SpringSource developer would give a deeper explanation

    But I suggest you do a research in Google, about when and why an interface should be Generic <T>.

    Comment

    Working...
    X