Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

11
LINES

< > BotCompany Repo | #1009701 // persistentObject

JavaX fragment (include)

1  
static <A> A persistentObject(S name, Class<? extends A> makeDefaultObject) {
2  
  ret persistentObject(name, (O) makeDefaultObject);
3  
}
4  
5  
// makeDefaultObject: (func -> A) or Class
6  
static <A> A persistentObject(S name, O makeDefaultObject) {
7  
  IVar<A> var = persistentVar(name);
8  
  if (!var.has()) var.set((A)
9  
    (makeDefaultObject instanceof Class ? nu((Class) makeDefaultObject) : callF(makeDefaultObject)));
10  
  ret var!;
11  
}

Author comment

Began life as a copy of #1009539

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1009701
Snippet name: persistentObject
Eternal ID of this version: #1009701/5
Text MD5: 9da8e43f0b7d14f290459e72589ceb13
Author: stefan
Category: javax / lists
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-08-14 17:26:21
Source code size: 430 bytes / 11 lines
Pitched / IR pitched: No / No
Views / Downloads: 593 / 560
Version history: 4 change(s)
Referenced in: [show references]