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

32
LINES

< > BotCompany Repo | #1006679 - optPar - get optional parameter from ThreadLocal or params

JavaX fragment (include)

static <A> A optPar(ThreadLocal<A> tl, A defaultValue) {
  A a = tl.get();
  if (a != null) {
    tl.set(null);
    ret a;
  }
  ret defaultValue;
}

static <A> A optPar(ThreadLocal<A> tl) {
  ret optPar(tl, null);
}

sO optPar(O[] params, S name) {
  ret optParam(params, name);
}

sO mapMethodLike optPar(S name, O[] params) {
  ret optParam(params, name);
}

sO mapMethodLike optPar(S name, Map params) {
  ret optParam(name, params);
}

static <A> A optPar(O[] params, S name, A defaultValue) {
  ret optParam(params, name, defaultValue);
}

static <A> A optPar(S name, O[] params, A defaultValue) {
  ret optParam(params, name, defaultValue);
}

Author comment

Began life as a copy of #1006091

download  show line numbers  debug dex   

Travelled to 10 computer(s): aoiabmzegqzx, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, tslmcundralx, tvejysmllsmz

No comments. add comment

Snippet ID: #1006679
Snippet name: optPar - get optional parameter from ThreadLocal or params
Eternal ID of this version: #1006679/11
Text MD5: 44bfbca0f635f56d74114ba020aa40ee
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-04-16 18:38:22
Source code size: 680 bytes / 32 lines
Pitched / IR pitched: No / No
Views / Downloads: 357 / 373
Version history: 10 change(s)
Referenced in: [show references]

Formerly at http://tinybrain.de/1006679 & http://1006679.tinybrain.de