Use case for manipulating a string of options

6 views
Skip to first unread message

David Groomes

unread,
Jun 2, 2016, 12:18:03 PM6/2/16
to jopt-simple
I have a use case to manipulate a string of options. E.g.

given: "-Dlog4j.debug --XX:MaxPermSize=512m
then return: "-Dlog4j.debug --XX:MaxPermSize=1024m"

I was thinking that JOpt Simple might be a good tool to use. But I might be wrong.

This is the process I envision:
  1. "crack" the input string to a String[] using org.apache.tools.ant.types.Commandline#translateCommandline (https://commons.apache.org/proper/commons-exec/apidocs/src-html/org/apache/commons/exec/CommandLine.html)
  2. parse the String[] to an OptionSet using JOpt Simple
  3. manipulate the OptionSet
  4. turn the OptionSet into a String, and return
Step #3 is the one I need help with (I've done the others). Is this a reasonable approach? Does JOpt Simple allow manipulating an OptionSet? Any recommendations?
Reply all
Reply to author
Forward
0 new messages