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

14
LINES

< > BotCompany Repo | #1031562 // getConceptOrMarkMissingObject

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

Libraryless. Click here for Pure Java version (15671L/101K).

static Concept nuLike getConceptOrMarkMissingObject(Concepts cc default db_mainConcepts(), Class<? extends Concept> requiredClass, long id) {
  if (cc == null) null;
  Concept c = getConcept(cc, id);
  if (isInstanceOf(c, requiredClass)) ret c;
  if (c instanceof CMissingObject) ret c;
  if (c != null) fail("Can't cast: " + toStringWithClassName(c) + "/" + requiredClass);
  
  // it's missing, create the CMissing marker
  lock dbLock(cc);
  if (getConcept(cc, id) == null)
    ret cnew(cc, CMissingObject);
    
  null;
}

download  show line numbers  debug dex  old transpilations   

Travelled to 4 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, vouqrxazstgt

No comments. add comment

Snippet ID: #1031562
Snippet name: getConceptOrMarkMissingObject
Eternal ID of this version: #1031562/3
Text MD5: 608ddacf114f8106100cb5d7e07cec62
Transpilation MD5: 109da534747b0be43dc7e781f4df263f
Author: stefan
Category: javax / concepts
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-06-22 03:12:26
Source code size: 538 bytes / 14 lines
Pitched / IR pitched: No / No
Views / Downloads: 160 / 236
Version history: 2 change(s)
Referenced in: [show references]