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

13
LINES

< > BotCompany Repo | #1009875 // persistentObjectFromProgram - load object stored with persistentObject() by another program

JavaX fragment (include)

1  
static <A> A persistentObjectFromProgram(S progID, S name) {
2  
  PersistentLister l = persistentListerReadOnly(progID);
3  
  IVar<A> v = l.getVar(name, null);
4  
  ret v == null ? null : v!;
5  
}
6  
7  
// makeDefaultObject: (func -> A) or Class
8  
static <A> A persistentObjectFromProgram(S progID, S name, O makeDefaultObject) {
9  
  A a = persistentObjectFromProgram(progID, name);
10  
  if (a == null)
11  
    ret (A) (makeDefaultObject instanceof Class ? nu((Class) makeDefaultObject) : callF(makeDefaultObject));
12  
  ret a;
13  
}

Author comment

Began life as a copy of #1009701

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: #1009875
Snippet name: persistentObjectFromProgram - load object stored with persistentObject() by another program
Eternal ID of this version: #1009875/7
Text MD5: 0a58df1640afbb0da33911d46f3ba09d
Author: stefan
Category: javax / lists
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-09-28 10:01:47
Source code size: 510 bytes / 13 lines
Pitched / IR pitched: No / No
Views / Downloads: 496 / 527
Version history: 6 change(s)
Referenced in: [show references]