Timeline for Validating multiple keys in the builder class based on the rules
Current License: CC BY-SA 3.0
10 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jul 1, 2014 at 20:54 | vote | accept | arsenal | ||
Jul 1, 2014 at 20:41 | comment | added | Vogel612 | If someone cannot supply useful parameters then make them and don't guess what they meant | |
Jul 1, 2014 at 20:39 | comment | added | Vogel612 | @Webby you want to tell me you want to ignore validation of the other parameters, depending on if you have set a certain parameter or not? Sorry but IMO that's complete nonsense. Also that cannot be accomplished with my approach. Is there an actual use-case for allowing setting of an emptystring to a deviceId when it's null (or emptystring, whatever you chose) already either way? | |
Jul 1, 2014 at 16:14 | comment | added | arsenal |
By exception I meant, IllegalArgumentException .
|
|
Jul 1, 2014 at 16:11 | comment | added | arsenal | Meaning, suppose if I am setting userId which is proper userId, greater than 0 but if I am setting, uuid and deviceId empty or null string, then it should not throw IllegalArgumentException. In your suggestion, it will throw an IllegalArgumentException right? Since in my case, userId has the highest priority, then uuid and then deviceId. So if userId is set, then I will do validation only on userId but if uuid is set only not userId, then I will do validation only on uuid but if userId and uuid is not set both, then I will do validation on deviceId. | |
Jul 1, 2014 at 16:04 | comment | added | Vogel612 | @webby an exception is very unspecific. What kind of exception and where?? | |
Jul 1, 2014 at 15:43 | comment | added | arsenal | .. With your suggestion if proper valid userId is set and by mistake somebody has set empty or null string for uuid and deviceId, then it will throw an exception. | |
Jul 1, 2014 at 15:43 | comment | added | arsenal |
Thanks a lot for your suggestion again. I like your wrapper approach of using Long but there is one issue with your example. I have updated the scenario for that in my question. Basically, if userId is set, no matter what is uuid and deviceId, I will validate only userId. But if userId is not set and uuid id is set, then I will validate uuid only and then if deviceId is set, then I will validate only deviceId. Since userId takes the priority first, then uuid and then deviceId.
|
|
Jul 1, 2014 at 8:23 | history | edited | Vogel612 | CC BY-SA 3.0 |
added 72 characters in body
|
Jul 1, 2014 at 7:26 | history | answered | Vogel612 | CC BY-SA 3.0 |