Results 1 to 2 of 2

Thread: Why the Validator interface is not generic in Spring 3.0

  1. #1
    Join Date
    Jul 2011
    Location
    Berlin, Germany
    Posts
    1

    Default 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. #2
    Join Date
    Aug 2006
    Location
    Arequipa-Peru / South America
    Posts
    2,796

    Default

    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>.
    - Manuel Jordan

    Kill Your Pride, Share Your Knowledge With All
    The Fear Of The LORD Is The Beginning Of Knowledge, But Fools Despise Wisdom And Discipline. Proverbs 1:7

    Blog


    Technical Reviewer of Apress

    • Pro SpringSource dm Server
    • Spring Enterprise Recipes: A Problem-Solution Approach
    • Spring Recipes: A Problem-Solution Approach, 2nd Edition
    • Pro Spring Integration
    • Pro Spring Batch
    • Pro Spring 3
    • Pro Spring MVC: With Web Flow
    • Pro Spring Security

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •