1 | static void zeroAllFieldsOfTypeExcept(O o, Class type, S... exceptions) {
|
2 | zeroAllFieldsOfTypeExcept(o, type, asSet(exceptions)); |
3 | } |
4 | |
5 | static void zeroAllFieldsOfTypeExcept(O o, Class type, Collection<S> exceptions) {
|
6 | Set<S> set = asSet(exceptions); |
7 | for (S field : allFields(o)) |
8 | if (!set.contains(field) && instanceOf(getOpt(o, field), type)) |
9 | set(o, field, null); |
10 | } |
Began life as a copy of #1016358
download show line numbers debug dex old transpilations
Travelled to 12 computer(s): bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
| Snippet ID: | #1019369 |
| Snippet name: | zeroAllFieldsOfTypeExcept - set all fields with a value of a certain type to null |
| Eternal ID of this version: | #1019369/2 |
| Text MD5: | 1b5581db64cf2da6ec17c1ccebd1240b |
| Author: | stefan |
| Category: | javax |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2018-11-04 19:13:34 |
| Source code size: | 387 bytes / 10 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 554 / 607 |
| Version history: | 1 change(s) |
| Referenced in: | [show references] |