sS standard_toString(O o) { if (o == null) ret "null"; S name = shortClassName(o); Set<S> fields = fieldNames(o); if (empty(fields)) ret name; ret name + "(" + joinWithComma(mapNonNulls(fields, field -> { O value = get(o, field); if (value == null) null; ret field + "=" + str(value); })) + ")"; }
download show line numbers debug dex old transpilations
Travelled to 8 computer(s): bhatertpkbcr, cfunsshuasjs, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, whxojlpjdney
No comments. add comment
| Snippet ID: | #1022820 |
| Snippet name: | standard_toString - stringify an object like a record |
| Eternal ID of this version: | #1022820/1 |
| Text MD5: | 37634ac479b23399e3dc1e9dcafe7455 |
| Author: | stefan |
| Category: | javax |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2019-04-09 11:05:36 |
| Source code size: | 331 bytes / 11 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 523 / 597 |
| Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) #1025941 - stdToStringWithFields - stringify an object like a record, showing certain fields only |