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

36
LINES

< > BotCompany Repo | #1021612 // FunctionCall

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

Libraryless. Click here for Pure Java version (7753L/43K).

static record noeq /*mapMethodLike*/ FunctionCall(Object function, Object... args) implements Transformable/*, IJavaXExpr*/ {
  sS _fieldOrder = "function args";
  
  // !customConstructor
  *(Object *function, Object... *args) {
    if (empty(this.args)) this.args = null;
  }
  
  *(Object function, L args) {
    this(function, toObjectArray(args));
  }
  
  toString {
    ret function + "(" + joinWithComma(allToString(args)) + ")";
  }
  
  S toStringWithOptionalParens() {
    ret empty(args) ? str(function) : toString();
  }
  
  public bool equals(O o) {
    ret o instanceof FunctionCall
      && eq(function, o/FunctionCall.function)
      && objectArraysEqual(args, o/FunctionCall.args);
  }
  
  public int hashCode() {
    ret hashAboutObjects(function, asList(args));
  }
  
  L args() { ret asList(args); }
  
  public Object transformUsing(IF1 f) {
    ret new FunctionCall(f.get(function), mapObjectArray(f, args));
  }
}

download  show line numbers  debug dex  old transpilations   

Travelled to 8 computer(s): bhatertpkbcr, cfunsshuasjs, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv

No comments. add comment

Snippet ID: #1021612
Snippet name: FunctionCall
Eternal ID of this version: #1021612/23
Text MD5: 3f351a40228448526f688fc5f9bd2a42
Transpilation MD5: 3b7a1774b458e9357386930f6e48dc58
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-04-06 04:59:18
Source code size: 975 bytes / 36 lines
Pitched / IR pitched: No / No
Views / Downloads: 424 / 1085
Version history: 22 change(s)
Referenced in: #1031812 - MethodCall_noeq
#1034167 - Standard Classes + Interfaces (LIVE, continuation of #1003674)