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

17
LINES

< > BotCompany Repo | #1031559 // setDynTransient - set a real or dynamic field and make it transient (through persistenceInfo)

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

Libraryless. Click here for Pure Java version (3063L/18K).

svoid setDynTransient(O o, S field, O value) ctex {
  if (o == null || field == null) ret;
  Field f = fieldObject(o, field);
  if (f != null) {
    f.set(o, value);
    if (isTransient(f))
      ret;
    else if (!o instanceof DynamicObject)
      fail("Can't make field transient: " + f);
  }
  
  if (o cast DynamicObject) {
    dynamicObject_setRawFieldValue(o, field, value);
    addToPersistenceInfo(o, field, false);
  } else
    fail("Field not found in " + className(o) + ": " + field);
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1031559
Snippet name: setDynTransient - set a real or dynamic field and make it transient (through persistenceInfo)
Eternal ID of this version: #1031559/5
Text MD5: 7dd25bf9be9c9975c1090bba6db6a1db
Transpilation MD5: 678ee6fa767c2069b568fc842d7354bd
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-06-22 00:41:31
Source code size: 513 bytes / 17 lines
Pitched / IR pitched: No / No
Views / Downloads: 175 / 247
Version history: 4 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)