Skip to main content
8 events
when toggle format what by license comment
Aug 31, 2014 at 10:18 history edited janos CC BY-SA 3.0
deleted 2 characters in body
Aug 26, 2014 at 20:52 comment added janos That link already exists in your code. Using a Map would make it easier to see for readers, making your code more intuitive, and at the same time more efficient. In any case, the mapping is in the private implementation of the class, so it's a hidden internal detail. I don't see anything wrong with it.
Aug 26, 2014 at 20:47 comment added Jeroen Vannevel Ah, like that. It doesn't feel very right to make the link between id and Game so loose. It's an interesting approach though, I'll keep it in mind. I see what you mean with the DI. I'm not sure if that's an option but I'll take a look at it later.
Aug 26, 2014 at 20:44 comment added Simon Forsberg The Map would be Map<Integer, Game> and I was just thinking the same thing about that
Aug 26, 2014 at 20:43 history edited janos CC BY-SA 3.0
added 16 characters in body
Aug 26, 2014 at 20:43 comment added janos Map of id -> Game. I'm not familiar with spring-web, but "regular" spring dependency injection supports initialization with contructor-args not only with setters. I prefer using immutable fields and initializing in constructor, as that way you know that the constructed object is complete.
Aug 26, 2014 at 20:38 comment added Jeroen Vannevel What would the Map be mapping exactly? Those setters aren't needed indeed, I just did a quick generate code in netbeans. The empty constructor is needed for Spring, something to do when I submit the form. I assume it's used to construct a new object and then fill its fields with reflection.
Aug 26, 2014 at 20:29 history answered janos CC BY-SA 3.0