> I'm creating a system to parse various different files. Each file has
> a certain format, so I have different parsers to handle each format
[quoted text clipped - 15 lines]
> I've searched for code examples online, but I can't find the
> information I'm looking for. Any help would be much appreciated.
On May 24, 10:26 am, Thomas Kellerer <JUAXQOSZF...@spammotel.com>
wrote:
> > I'm creating a system to parse various different files. Each file has
> > a certain format, so I have different parsers to handle each format
[quoted text clipped - 37 lines]
>
> - Show quoted text -
Your second method works (after some tweaking, of course). Thank you.
However, I had also been thinking about the first solution. But, I'm
trying to think about it this way - I won't be working on this code
forever, and I want to ensure that those values will be populated by
the next developer. (If they aren't, the FileParsing won't work.)
There's no way to ensure that those methods are called (or that the
variables are initialized) no matter what...is there?
Anyway, thank you for your help. Much appreciated.
stefanomnn - 24 May 2007 16:17 GMT
HI!
in previous solution,
you could check value1,value2 and value3 != null;
il null you could throw a nullPointerException!
Stefano
Jason Cavett ha scritto:
> On May 24, 10:26 am, Thomas Kellerer <JUAXQOSZF...@spammotel.com>
> wrote:
[quoted text clipped - 52 lines]
>
> Anyway, thank you for your help. Much appreciated.
Mike Schilling - 24 May 2007 18:45 GMT
> On May 24, 10:26 am, Thomas Kellerer <JUAXQOSZF...@spammotel.com>
> wrote:
[quoted text clipped - 50 lines]
> There's no way to ensure that those methods are called (or that the
> variables are initialized) no matter what...is there?
You could write a checkInitialized() method that throws an exception if they
haven't been initialized, and call it at the start of every public method.
But I think that doing construction of the object in the constructor is
clearer.