[
https://issues.apache.org/jira/browse/OPENNLP-402?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13159946#comment-13159946
]
Joern Kottmann commented on OPENNLP-402:
----------------------------------------
I am proposing the following change to simplify these Abstract classes and
interfaces.
We make one abstract CmdLineTool class which can get one parameter. The
parameter could be used for anything, and must not always be a format.
abstract class CmdLineTool {
void getName() {..} //default implementation which uses the class name to get
the name
String getShortDescription(){return "";}
String[] supportedFormats(); // returns an empty array when only default
format is supported
String getHelp(String format){...} // returns default string with tool name,
but zero parameters
abstract void run(String format, String args[]); // format is null when not
specified
}
Util methods from AbstractCLITool could be moved into a util class and imported
via static import.
What do you think?
I committed a few things, in case you make changes, please update your branch.
> CLI tools and formats refactored
> --------------------------------
>
> Key: OPENNLP-402
> URL: https://issues.apache.org/jira/browse/OPENNLP-402
> Project: OpenNLP
> Issue Type: Improvement
> Components: Command Line Interface, Formats
> Affects Versions: tools-1.5.3-incubating
> Reporter: Aliaksandr Autayeu
> Labels: patch
> Attachments: 0016-CLI-tools-and-formats-refactored.patch,
> 0017-added-direct-format-support-to-CLI-tools-and-formats.patch
>
>
> Proposed patch refactors CLI tools and simplifies the code by introducing
> hierarchy and removing a lot of code duplication. It also introduces better
> error and help messages, including help for formats and listing available
> formats in various tools, which are now able to work with formats directly.
> This, in turn, eliminates the need to keep converted files on disk.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira