Details
-
Improvement
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
None
-
None
-
None
Description
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:
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(); } }
Attachments
Issue Links
- links to