Libraryless. Click here for Pure Java version (2826L/17K).
// o is either a map already (string->object) or an arbitrary object, // in which case its fields are converted into a map. static Map<S, O> objectToMap_nonTransient(O o) { if (o == null) null; if (o instanceof Map) ret (Map) o; new HashMap<S, O> map; for (Field field : nonStaticNonTransientFieldObjects_cachedArray(o)) { O value = fieldGet(field, o); if (value != null) map.put(field.getName(), value); } // TODO: Should we drop fieldValues key from map? if (o cast DynamicObject) putAll(map, o.fieldValues); ret map; }
Began life as a copy of #1002179
download show line numbers debug dex old transpilations
Travelled to 8 computer(s): bhatertpkbcr, ekrmjmnbrukm, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv
No comments. add comment
Snippet ID: | #1027622 |
Snippet name: | objectToMap_nonTransient |
Eternal ID of this version: | #1027622/6 |
Text MD5: | 00e212f1b215d9dacf98cf654de33578 |
Transpilation MD5: | 82cea4330e4d86585d6fbc7d7af52176 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2021-04-26 18:12:29 |
Source code size: | 580 bytes / 19 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 202 / 303 |
Version history: | 5 change(s) |
Referenced in: | [show references] |