|
From: Bruce M. <br...@mc...> - 2003-08-06 03:45:28
|
This pattern is used for all commandline tools.
I guess that most variables that are needed should be encapsulated in a class
that is created and deleted within execute.
regards,
Bruce.
On Tuesday 05 August 2003 11:45 pm, David Glick wrote:
> I noticed that the constructor for Scanner looks like (or, actually, IS):
>
> public Scanner(String[] args) {
> super("scanner", I18n.get("scanner.Scanner.toolDescription"), args);
> }
>
> which I believe causes the parent BabelDocCommand class constructor to
> initialize the command line properly and then invoke execute() on Scanner.
> What seems to be happening, though, is that, should any private variables
> be initialized at declaration (private boolean test = false;), and then set
> to true in execute(), it will be false again in finishUp(). Apparently,
> not all variables are initialized at the time that the constructor is
> called, and so the variables are initialized sometime after execute() is
> executing...
>
> This caused me some intersting moments in trying to have the Scanner class
> end elegantly after displaying the help screen. I assume that all the
> other tools use the same architecture. Is this a known side effect?
>
>
> David
|