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).

1  
static SimpleLiveValue conceptFieldLiveValue(Concept c, S fieldName) {
2  
  Class type = getFieldType(c, fieldName);
3  
  SimpleLiveValue value = new(type, cget(c, fieldName));
4  
  // TODO: make mechanism for listening to a single concept
5  
  onConceptChangeByClass_notOnAllChanged(c.getClass(), r {
6  
    O o = cget(c, fieldName);
7  
    value.set(o);
8  
  });
9  
  value.onChange(r {
10  
    cset(c, fieldName, value!);
11  
  });
12  
  ret value;
13  
}
14  
15  
static SimpleLiveValue mapMethodLike conceptFieldLiveValue(S fieldName, Concept c) {
16  
  ret conceptFieldLiveValue(c, fieldName);
17  
}

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: 92 / 154
Version history: 1 change(s)
Referenced in: [show references]