> I have a few related classes which throw a DataException from the
> constructor if the data passed is invalid. I can't exactly say that the
> data validation is exactly the same for these classes, but they're
> similar. Basically, count the number of String[] elements, try to parse
> Integer or Float values and so forth; there's some overlap.
Where come from these String of the String[] array?
> What's the standard approach? Multiple anonymous inner classes? A
> static utility class? Verify the data before sending it to the
> constructor?
You are putting the parsing of the Strings in the object constructor.
For better reusability I suggest you to move this responsibility to
another class called Parser that read the Strings and returns the
parameters to be used for calling the the object constructor. If the
parsing fails it throws a ParseException.
> Or, create a DataValidator class which the constructor instatiates?
>
> thanks,
>
> Thufir

Signature
Andrea Francia
http://code.google.com/p/remoted-list/ - Lazy loading lists through RMI.