Re: How to drop this exception?



"Oliver Wong" <owong@xxxxxxxxxxxxxx> wrote in
arSRg.32826$bf5.11259@edtnps90:">news:arSRg.32826$bf5.11259@edtnps90:

<snipped>
c) pass in the name of a class which needs to be instantiated (best
option I guess)

Possible, but this uses reflection, and generally it's better to
use a
non-reflective solution in preference to a reflective one.

Is there a special reason you can't just catch (or throw) the
exception?

Yes - it seems sloppy.

The entire reason for using the third party package is to "hide" all the
database stuff (and it's exceptions).

So it's pretty stupid to use a package to hide all that database specific
stuff, if you still have to use the exceptions in order to create objects
to pass to said package!

Personally, I'd prefer NOT to hide the exceptions at all, and just catch
them where they need to be caught.

Thanks,

Ikke
.



Relevant Pages

  • Re: How to drop this exception?
    ... Is there a special reason you can't just catch the ... database stuff (and it's exceptions). ... So it's pretty stupid to use a package to hide all that database specific ...
    (comp.lang.java.help)
  • Re: Repositories, package dependencies, and domain-flavoured exceptions
    ... Always return a customer. ... > particular kind of Customer using an Account Number. ... The Repository is in the "domain" package, the exceptions are ...
    (comp.object)
  • Package organisation question.
    ... I maintain a small package for talking to the API of BulkSMS.co.uk. ... have been adding support for some new features recently, ... all derived exceptions that my package throws. ... I am now adding support for 2-way SMS to the ...
    (comp.lang.python)
  • Re: Repositories, package dependencies, and domain-flavoured exceptions
    ... The Repository is in the "domain" package, the exceptions ... > are in the "command" package. ... where are your Customer and Account classes, ...
    (comp.object)
  • Re: Reflection: Instantiate All Classes in a Package?
    ... It is trivial, albeit a little slow, to probe a classloader for all the ... Through writing custom ClassLoaders or, parsing the class path/bootstrap path/extensions directory, one can obtain the needed classes. ... The OP originally asked for the answer using /reflection/ -- he was more or less asking if the answer could there was a method along the lines of getAllClasses(String package). ... Yes, one can get a list of classes in a certain package through various means, but no, it cannot be done through /pure/ reflection. ...
    (comp.lang.java.programmer)