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

// only works when owning concept is subclass of ConceptWithChangeListeners
sclass ConceptRefVar<A extends Concept> is IVarWithNotify<A> {
  Concept.Ref<A> ref;
  event fireChange;
  
  *(Concept.Ref<A> *ref) {
    ((ConceptWithChangeListeners) ref.concept()).onChange(l0 fireChange);
  }
  
  public void set(A a) { ref.set(a); }
  public A get() { ret ref!; }
}

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: 67 / 131
Version history: 9 change(s)
Referenced in: [show references]