// TODO: optimize (use getOpt_cache) static void setOpt_raw(Object o, String field, Object value) ctex { if (o == null) ret; if (o instanceof Class) setOpt_raw((Class) o, field, value); else { Field f = setOpt_raw_findField(o.getClass(), field); if (f != null) { makeAccessible(f); smartSet(f, o, value); } } } static void setOpt_raw(Class c, String field, Object value) ctex { if (c == null) ret; Field f = setOpt_raw_findStaticField(c, field); if (f != null) { makeAccessible(f); smartSet(f, null, value); } } static Field setOpt_raw_findStaticField(Class<?> c, String field) { Class _c = c; do { for (Field f : _c.getDeclaredFields()) if (f.getName().equals(field) && (f.getModifiers() & java.lang.reflect.Modifier.STATIC) != 0) return f; _c = _c.getSuperclass(); } while (_c != null); ret null; } static Field setOpt_raw_findField(Class<?> c, String field) { Class _c = c; do { for (Field f : _c.getDeclaredFields()) if (f.getName().equals(field)) return f; _c = _c.getSuperclass(); } while (_c != null); ret null; }
Began life as a copy of #1000891
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt, whxojlpjdney
No comments. add comment
Snippet ID: | #1009441 |
Snippet name: | setOpt_raw function (set field by reflection, ignore if it's a Map) |
Eternal ID of this version: | #1009441/7 |
Text MD5: | 6b6e028568c249a30bc637a56829607a |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2022-03-03 17:54:04 |
Source code size: | 1175 bytes / 43 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 555 / 698 |
Version history: | 6 change(s) |
Referenced in: | [show references] |