[ 
https://issues.apache.org/jira/browse/OPENNLP-1044?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Koji Sekiguchi resolved OPENNLP-1044.
-------------------------------------
       Resolution: Fixed
    Fix Version/s: 1.8.0

> Add validate() which checks validity of parameters in the process of the 
> framework
> ----------------------------------------------------------------------------------
>
>                 Key: OPENNLP-1044
>                 URL: https://issues.apache.org/jira/browse/OPENNLP-1044
>             Project: OpenNLP
>          Issue Type: Improvement
>            Reporter: Koji Sekiguchi
>            Assignee: Koji Sekiguchi
>            Priority: Minor
>             Fix For: 1.8.0
>
>
> When I worked on OPENNLP-1039, I saw the client codes throw 
> IllegalArgumentException when isValid() returns false, but I think such kind 
> of methods should throw the Exception by themselves and the timing of use 
> should be controlled by the framework.
> So it should look like:
> {code}
> public abstract class AbstractTrainer {
>   @Depracated
>   public boolean isValid() { ... }
>   // if the subclass overrides this, it should call super.validate();
>   public void validate() throws IllegalArgumentException {
>     // default implementation here
>   }
>   // this is the controller of the flow of training...
>   public final void train() {
>     // initializing 
>     init();
>     // validating parameters
>     validate();
>   }
> }
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to