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

24
LINES

< > BotCompany Repo | #1034433 // FieldVar - variable representing a field

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

Libraryless. Click here for Pure Java version (9667L/53K).

sclass FieldVar<A> extends VarWithNotify<A> {
  IHasChangeListeners containingObject;
  S fieldName;
  IF0<A> getter;
  IVF1<A> setter;

  *(IHasChangeListeners *containingObject,
    S *fieldName, IF0<A> *getter, IVF1<A> *setter) {
    containingObject.onChangeAndNow(l0 _updateFromObject);
  }
  
  void _updateFromObject {
    set(getter!);
  }
  
  public void fireChange :: before {
    setter.get(get());
  }
  
  public selfType onChange(IVF1<A> r) {
    if (r != null) onChange(-> r.get(get()));
    this;
  }
}

Author comment

Began life as a copy of #1034091

download  show line numbers  debug dex  old transpilations   

Travelled to 4 computer(s): bhatertpkbcr, ekrmjmnbrukm, mowyntqkapby, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1034433
Snippet name: FieldVar - variable representing a field
Eternal ID of this version: #1034433/8
Text MD5: 8f740bb149d5179165e2b9ed0a00bd54
Transpilation MD5: bfff7f3c728e323d4e9a4f99ca214056
Author: stefan
Category: javax / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-02-12 23:05:37
Source code size: 542 bytes / 24 lines
Pitched / IR pitched: No / No
Views / Downloads: 220 / 322
Version history: 7 change(s)
Referenced in: #1003674 - Standard Classes + Interfaces (LIVE continued in #1034167)