-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve ConvertService to properly convert lists and arrays to String values #281
Comments
I guess a first step would be to fix the result of #@ ConvertService cs
#@OUTPUT boolean stringToFile
#@OUTPUT boolean stringListToFile
#@OUTPUT boolean stringToFileList
#@OUTPUT boolean stringListToFileList
#@OUTPUT boolean fileToString
#@OUTPUT boolean fileListToString
#@OUTPUT boolean fileToStringList
#@OUTPUT boolean fileListToStringList
fileList = [new File("test1.txt"), new File("test2.txt")]
stringList = ["a", "b"]
stringToFile = cs.supports("aFile", File.class)
stringListToFile = cs.supports(stringList, File.class)
stringToFileList = cs.supports("aFile", File[].class)
stringListToFileList = cs.supports(stringList, File[].class)
fileToString = cs.supports(new File("aFile"), String.class)
fileListToString = cs.supports(fileList, String.class)
fileToStringList = cs.supports(new File("aFile"), String[].class)
fileListToStringList = cs.supports(fileList, String[].class) Then we'll have to provide a converter supporting
Comments welcome, I'll try to work on it over the coming weeks. |
I'd vote to use a path separator similar to how this is done from the CLI. This is |
Currently,
DefaultConvertService
supports conversion fromFile[]
toString
and vice versa, but the result is wrong (i.e. aString
representation of theFile[]
array, such as[Ljava.io.File;@31c3cff5
).The following Groovy script illustrates the issue:
(The expected re-convertible output in this case should be something like
test1.csv\ntest2.csv
, ideally with the absolute paths of the files)See also some related discussion in scijava/scijava-ui-swing#27.
The text was updated successfully, but these errors were encountered: