Libraryless. Click here for Pure Java version (13251L/90K).
1 | // returns true if change |
2 | // DUPLICATED in convertToField AND DefaultValueConverterForField... |
3 | sbool _cSmartSetField(Concept c, S field, O value) ctex { |
4 | Field f = setOpt_findField(c.getClass(), field); |
5 | if (f != null && value != null) { |
6 | Class actualType = f.getType(); |
7 | Class type = primitiveToBoxedTypeOpt(actualType); |
8 | |
9 | // int magic |
10 | |
11 | if (type == Int.class && !value instanceof Int) { |
12 | if (!setField_trueIfChanged(f, c, toInt(trimIfString(value)))) false; |
13 | if (!isTransient(f)) c.change(); |
14 | true; |
15 | } |
16 | |
17 | // bool magic |
18 | |
19 | if (type == Bool.class && value instanceof S) |
20 | if (actualType == Bool.class && eq(value, "")) |
21 | ret _csetField(c, field, null); |
22 | else |
23 | ret _csetField(c, field, eqicOneOf((S) value, "1", "true", "yes")); |
24 | |
25 | // GlobalID magic |
26 | |
27 | ifclass GlobalID |
28 | if (type == GlobalID.class && value instanceof S) |
29 | ret _csetField(c, field, GlobalID((S) value)); |
30 | endif |
31 | } |
32 | ret _csetField(c, field, value); |
33 | } |
Began life as a copy of #1026007
download show line numbers debug dex old transpilations
Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv
No comments. add comment
Snippet ID: | #1026010 |
Snippet name: | _cSmartSetField - kinda duplicated in convertToField |
Eternal ID of this version: | #1026010/10 |
Text MD5: | 6b9947932d30cde76b51b3acae81e664 |
Transpilation MD5: | b1e40330b244334f7f76ae24b8aa676e |
Author: | stefan |
Category: | javax / concepts |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2020-09-27 16:40:29 |
Source code size: | 1040 bytes / 33 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 289 / 453 |
Version history: | 9 change(s) |
Referenced in: | [show references] |