Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

5
LINES

< > BotCompany Repo | #1016358 // zeroAllFieldsOfType - set all fields with a value of a certain type to null

JavaX fragment (include)

static void zeroAllFieldsOfType(O o, Class type) {
  for (S field : allFields(o))
    if (instanceOf(getOpt(o, field), type))
      set(o, field, null);
}

download  show line numbers  debug dex  old transpilations   

Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1016358
Snippet name: zeroAllFieldsOfType - set all fields with a value of a certain type to null
Eternal ID of this version: #1016358/3
Text MD5: 4f9a5ed88d537462f9de66cc3f81c881
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-06-16 14:47:53
Source code size: 158 bytes / 5 lines
Pitched / IR pitched: No / No
Views / Downloads: 368 / 401
Version history: 2 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1019369 - zeroAllFieldsOfTypeExcept - set all fields with a value of a certain type to null