Uses 911K of libraries. Click here for Pure Java version (2761L/14K).
!7 cmodule TransientObjectHolder > DynPrintLog { switchable bool cleanUpObject = true; transient O object; transient bool reloading; void cleanMeUp { if (cleanUpObject && !reloading) { print("Cleaning up held object"); cleanUp(object); } } // API O get() { ret object; } void set(O object) { setField(+object); printInfo(); } void printInfo { if (object == null) ret /*with print("No object")*/; print("Have object of type: " + _getClass(object)); print("Get it out with: dm_obj(" + dm_moduleID() + ")"); } void clear() { set(null); } O _getReloadData() { set reloading; //print("_getReloadData: " + object; ret object; } void _setReloadData(O o) { //print("_setReloadData: " + o); set(o); } start { printInfo(); } // API void dontCleanUp { setField(cleanUpObject := false); } }
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: | #1027453 |
Snippet name: | Transient Object Holder [holds a single transient Java object] |
Eternal ID of this version: | #1027453/17 |
Text MD5: | 39b45e6f13707d5d6e4d05a381e0028a |
Transpilation MD5: | 659d5ffda158ece4d78185a6a9bdd571 |
Author: | stefan |
Category: | javax |
Type: | JavaX source code (Dynamic Module) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2020-08-07 01:58:28 |
Source code size: | 989 bytes / 56 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 313 / 871 |
Version history: | 16 change(s) |
Referenced in: | [show references] |