question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Be able to pre transform or overlay the String value of DataTable before it is converted

See original GitHub issue

Originally, I’m looking to support the needs of being able to resolve a set of values like null. For example,

Given I have a list of Person, configured as follows:
  | firstName | lastName |
  | Sid       | L        |
  | Kate      | [null]   |

This can be translated to List<Person> nicely, if Person class has firstName and lastName field. However, preferred result of Kate’s last name is actually expected to be null, not literally [null].

For a single value, this could be done with @Transform to convert null string ([null], null, Null, etc.) into null. But up to this point, @Transform doesn’t work with DataTable. I’m guessing the reason @Transform is not applicable to DataTable because asList, and asMap already does the job through TableConverter.

However, I can’t seems to find a nice solution to actually solve the above scenario. So I’m thinking that it might be good to make @Transform applicable to DataTable, but only to do some pre-conversion, more like List<String> --> List<Person>, so that users can still benefit from the TableConverter without doing extra works, but still be able to redefine some meaning in the gherkin table.

Proposed Solution

According to the current codebase, I understand that there’s a code in DataTable that converts List<DataTableRow> into List<List<String>>, upon its construction.

Would it be a good idea to apply Transformer class upon this process to resolve the mentioned scenario? I can submit a PR that could help illustrate this.

Alternative Ideas
  1. Using @Transform may be confusing in what it actually does. Maybe something like @Transform(pre = Transformer.class)
  2. Or may be come up with @PreTransform.

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
brasmussoncommented, Sep 1, 2016

@manat I tip for you would be to reference the issue (with “#XXX”) in the PR description instead of in the PR title, then Github picks up the reference and make it visible in the issue in question. Even better is to use a keyword to closing issues (for instance “closes #XXX”) in the PR description, the Github will close the issue when the PR is merged.

0reactions
lock[bot]commented, Dec 20, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Package 'data.table'
Convert all character columns to factors? x. A data.table. i. Integer, logical or character vector, single column numeric matrix, expression.
Read more >
How to convert a DataTable to a string in C#? - Stack Overflow
StringWriter ' Loop through each column. ' For Each col As DataColumn In table.Columns ' Output the value of each column's data. sw.Write(row(col)....
Read more >
ui.datatable, API Reference Webix Docs - Documentation
showItemByIndex, scrolls the table to make the specified row visible ; showOverlay, shows the overlay message over the body of DataTable ; sort,...
Read more >
Perspective - Table - Ignition User Manual 8.1
When a Column Config option is present, the table reflects that custom configuration, such as a single cell of a Table component being...
Read more >
JavaScript · Bootstrap
If you'd like to get a particular plugin instance, retrieve it directly from an element: $('[rel="popover"]').data('popover') . Default settings. You can change ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found