You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would like to have the possibility to go from a list of strings as input to an object, i.e. have an interface similar to IStringConverter that instead take a list of Strings or possibly an array. This would solve issues were a complex type needs to be specified, or one that has dynamic parameters depending on the concrete implementation. For example I take input files that can be of several formats, so I'd like to get a syntax like:
--input-file CSV delimiter:, header:true
But if I instead have a JSON input, the delimiter and header arguments are not possible. I've solved this currently by only taking a List of variable arity and then add conversion into the final object afterward. But that makes the flow in the code somewhat odd and easier to miss doing the conversion. So an interface:
public interface IStringListConverter {
T convert(List values);
}
Or is there any current approach that would solve this in a better way?
The text was updated successfully, but these errors were encountered:
I would like to have the possibility to go from a list of strings as input to an object, i.e. have an interface similar to IStringConverter that instead take a list of Strings or possibly an array. This would solve issues were a complex type needs to be specified, or one that has dynamic parameters depending on the concrete implementation. For example I take input files that can be of several formats, so I'd like to get a syntax like:
--input-file CSV delimiter:, header:true
But if I instead have a JSON input, the delimiter and header arguments are not possible. I've solved this currently by only taking a List of variable arity and then add conversion into the final object afterward. But that makes the flow in the code somewhat odd and easier to miss doing the conversion. So an interface:
public interface IStringListConverter {
T convert(List values);
}
Or is there any current approach that would solve this in a better way?
The text was updated successfully, but these errors were encountered: