Libraryless. Click here for Pure Java version (10459L/58K).
1 | static <A> A resetFields(A object, S fields) { |
2 | if (object != null) { |
3 | O emptyInstance = newInstance(object.getClass()); |
4 | resetFields(object, fields, emptyInstance); |
5 | } |
6 | ret object; |
7 | } |
8 | |
9 | static <A> A resetFields(A object, S fields, O emptyInstance) { |
10 | for (S field : identifiers(fields)) |
11 | setOpt(object, field, getOpt(emptyInstance, field)); |
12 | ret object; |
13 | } |
Began life as a copy of #1024027
download show line numbers debug dex old transpilations
Travelled to 3 computer(s): elmgxqgtpvxh, mqqgnosmbjvj, wnsclhtenguj
No comments. add comment
Snippet ID: | #1036232 |
Snippet name: | resetFields |
Eternal ID of this version: | #1036232/7 |
Text MD5: | 2c6fdd4c42a24cfaeda3d746995edd1e |
Transpilation MD5: | a5a7d319940b009bbca1965c3816b617 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2023-03-20 20:36:03 |
Source code size: | 380 bytes / 13 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 177 / 252 |
Version history: | 6 change(s) |
Referenced in: | [show references] |