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

22
LINES

< > BotCompany Repo | #1031850 // convertObjectMetaToMap

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Compilation Failed (5208L/30K).

1  
static Map convertObjectMetaToMap(IMeta o, IF0<Map> createEmptyMap default () -> makeObjectMetaMap()) {
2  
  if (o == null) null;
3  
  
4  
  // The following shortcut depends on the assumption that a meta field never reverts
5  
  // to null when it was a map
6  
  ifndef MetaCanRevertToNull
7  
    O meta = o._getMeta();
8  
    if (meta cast Map) ret meta;
9  
  endifndef
10  
  
11  
  // non-shortcut path (create meta)
12  
  temp var mutex = tempMetaMutex(o);
13  
  var actualMutex = mutex!;
14  
  synchronized(actualMutex) {
15  
    meta = o._getMeta();
16  
    if (meta cast Map) ret meta;
17  
    Map map = createEmptyMap!;
18  
    if (meta != null) map.put(previousMeta := meta);
19  
    o._setMeta(map);
20  
    ret map;
21  
  }
22  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 3 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx

No comments. add comment

Snippet ID: #1031850
Snippet name: convertObjectMetaToMap
Eternal ID of this version: #1031850/9
Text MD5: 9a7b00e0544953352ce85f576f467410
Transpilation MD5: 7368dd3db7c4e5b56349c9108a352f3b
Author: stefan
Category: javax / reasoning
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-01-20 01:47:13
Source code size: 685 bytes / 22 lines
Pitched / IR pitched: No / No
Views / Downloads: 205 / 299
Version history: 8 change(s)
Referenced in: [show references]