Announcement Announcement Module
No announcement yet.
Generic type in model Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Generic type in model

    I have Generic Type in modal

    class BaseEntity
    public int id;

    class UserEntity extends BaseEntity
    string name;
    string password;

    class RoleEntity extends BaseEntity
    string description;

    class GenericModal<T extends BaseEntity>
    public T MyEntity; //has get and set methods

    //now in
    @RequestMapping(value="", method=RequestMethod.POST)
    public ModelAndView Filter(@ModelAttribute("entity") GenericListModal<RoleEntity> entity, BindingResult result, SessionStatus status) throws InstantiationException, IllegalAccessException
    return super.Filter(entity, result, status);



    I can't get it worked. it gives error T can't instantiated.
    Can any one give me any hint how to over come with this.

    The same thing works perfectly in ASP.Net MVC