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

12
LINES

< > BotCompany Repo | #1035791 // ConceptRefVar (dev.) - convert Concept.Ref to IVarWithNotify - note: use inside a simplyCached var...() method!

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

Libraryless. Click here for Pure Java version (22748L/139K).

1  
// only works when owning concept is subclass of ConceptWithChangeListeners
2  
sclass ConceptRefVar<A extends Concept> is IVarWithNotify<A> {
3  
  Concept.Ref<A> ref;
4  
  event fireChange;
5  
  
6  
  *(Concept.Ref<A> *ref) {
7  
    ((ConceptWithChangeListeners) ref.concept()).onChange(l0 fireChange);
8  
  }
9  
  
10  
  public void set(A a) { ref.set(a); }
11  
  public A get() { ret ref!; }
12  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 3 computer(s): elmgxqgtpvxh, mqqgnosmbjvj, wnsclhtenguj

No comments. add comment

Snippet ID: #1035791
Snippet name: ConceptRefVar (dev.) - convert Concept.Ref to IVarWithNotify - note: use inside a simplyCached var...() method!
Eternal ID of this version: #1035791/10
Text MD5: 18842baef2448abbf01858928d2d3d27
Transpilation MD5: 9197e30e44dbee23e3a55d771d1c17fa
Author: stefan
Category: javax / concepts
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-07-29 16:48:03
Source code size: 376 bytes / 12 lines
Pitched / IR pitched: No / No
Views / Downloads: 123 / 214
Version history: 9 change(s)
Referenced in: [show references]