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

17
LINES

< > BotCompany Repo | #1031140 // conceptFieldLiveValue - LiveValue reflecting a concept's field. Not for Ref/RefL fields!

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

Libraryless. Click here for Pure Java version (15345L/99K).

static SimpleLiveValue conceptFieldLiveValue(Concept c, S fieldName) {
  Class type = getFieldType(c, fieldName);
  SimpleLiveValue value = new(type, cget(c, fieldName));
  // TODO: make mechanism for listening to a single concept
  onConceptChangeByClass_notOnAllChanged(c.getClass(), r {
    O o = cget(c, fieldName);
    value.set(o);
  });
  value.onChange(r {
    cset(c, fieldName, value!);
  });
  ret value;
}

static SimpleLiveValue mapMethodLike conceptFieldLiveValue(S fieldName, Concept c) {
  ret conceptFieldLiveValue(c, fieldName);
}

Author comment

Began life as a copy of #1015971

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1031140
Snippet name: conceptFieldLiveValue - LiveValue reflecting a concept's field. Not for Ref/RefL fields!
Eternal ID of this version: #1031140/2
Text MD5: f4da3e0e375b6251156dbeed11735515
Transpilation MD5: c331e92e6b1f5068ca1c2eb3b3892df2
Author: stefan
Category: javax / stefan's os
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-05-12 17:46:23
Source code size: 564 bytes / 17 lines
Pitched / IR pitched: No / No
Views / Downloads: 89 / 149
Version history: 1 change(s)
Referenced in: [show references]