Timeline for How to make sure that each field's setter executes a specific code?
Current License: CC BY-SA 3.0
19 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jul 22, 2017 at 15:04 | vote | accept | srh | ||
Jul 17, 2017 at 20:40 | comment | added | Laiv | Take a look here | |
Jul 17, 2017 at 20:34 | comment | added | Laiv | Maybe via reflection you can. But putting code on the parent "to spy" children don't seems good design to me. Despite your doubts, typing the conditions explictly in each subclass, makes your code cleaner , simpler and readable. | |
Jul 17, 2017 at 20:26 | comment | added | srh |
@Laiv I like the example you gave but is it possible that isEmpty() method of BaseBO class is not abstract and instead dynamically go through all the fields of the class and evaluate the same expression something like return field1 == null && field2 == null && ... fieldn == null ? This way I dont have to define isEmpty() method in sub classes. Example: in Location class the isEmpty() method will evaluate to return description == null && active == null .
|
|
Jul 17, 2017 at 10:09 | history | edited | Laiv | CC BY-SA 3.0 |
Added the reference to AOP
|
Jul 17, 2017 at 8:49 | history | edited | Laiv | CC BY-SA 3.0 |
spellcheck revision
|
Jul 17, 2017 at 1:27 | comment | added | Thomas Junk | As I suspected, it is an XY-Problem. And I suggest to accept this answer. | |
Jul 16, 2017 at 20:36 | history | edited | Laiv | CC BY-SA 3.0 |
added 5 characters in body
|
Jul 16, 2017 at 20:31 | history | edited | Laiv | CC BY-SA 3.0 |
added 26 characters in body
|
Jul 16, 2017 at 16:48 | history | edited | Laiv | CC BY-SA 3.0 |
added 644 characters in body
|
Jul 16, 2017 at 13:56 | history | edited | Laiv | CC BY-SA 3.0 |
added 555 characters in body
|
Jul 16, 2017 at 12:29 | history | edited | Laiv | CC BY-SA 3.0 |
added 3 characters in body
|
Jul 16, 2017 at 10:57 | history | edited | Laiv | CC BY-SA 3.0 |
added 7 characters in body
|
Jul 16, 2017 at 8:51 | history | edited | Laiv | CC BY-SA 3.0 |
added 173 characters in body; added 76 characters in body
|
Jul 16, 2017 at 8:44 | history | edited | Laiv | CC BY-SA 3.0 |
edited body; deleted 21 characters in body; added 51 characters in body; deleted 51 characters in body
|
Jul 16, 2017 at 8:39 | history | edited | Laiv | CC BY-SA 3.0 |
added 543 characters in body; added 65 characters in body; deleted 23 characters in body; deleted 739 characters in body
|
Jul 16, 2017 at 8:33 | history | edited | Laiv | CC BY-SA 3.0 |
added 179 characters in body; edited body; deleted 42 characters in body
|
Jul 16, 2017 at 8:28 | history | edited | Laiv | CC BY-SA 3.0 |
added 32 characters in body; added 6 characters in body
|
Jul 16, 2017 at 8:22 | history | answered | Laiv | CC BY-SA 3.0 |