Libraryless. Click here for Pure Java version (3524L/21K).
1 | // e.g. class JavaInputConditionToCode extends DynCRUD<Entry> |
2 | // => add constructor JavaInputConditionToCode() { super(Entry.class); } |
3 | |
4 | svoid tok_crudAutoConstructor(LS tok) { |
5 | for (int i : jfindAll_reversed(tok, "<id> extends <id>< <id> >", (_tok, nIdx) -> equalsOrStartsWithPlusUnderscore(tok.get(nIdx+5), "DynCRUD"))) { |
6 | S className = tok.get(i), typeName = tok.get(i+8); |
7 | LS body = tok_classBody(tok, i); |
8 | if (!jcontains(body, className + "()", tokcondition { |
9 | ret eqOneOf(_get(tok, i-1), null, "}", ";"); |
10 | })) { |
11 | int j = indexOf(tok, "{", i); |
12 | tokAppend_reTok(tok, j, "\n " + className + "() { super(" + typeName + ".class); }"); |
13 | } |
14 | } |
15 | } |
download show line numbers debug dex old transpilations
Travelled to 8 computer(s): bhatertpkbcr, cfunsshuasjs, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1021003 |
Snippet name: | tok_crudAutoConstructor |
Eternal ID of this version: | #1021003/14 |
Text MD5: | 27e011bc22d1da74b9bd6654dda653dd |
Transpilation MD5: | 6fb91aac9454fdef744efdb7bb5b9f88 |
Author: | stefan |
Category: | javax / transpiling |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2021-03-18 15:38:06 |
Source code size: | 689 bytes / 15 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 343 / 980 |
Version history: | 13 change(s) |
Referenced in: | [show references] |