Menu

#1058 Support for explicit assumptions

Core
open
nobody
None
5
2011-09-10
2011-09-10
No

Hi,
I'd like to contribute a little static method "Util.assume" that I used a lot at metas. It's similar to the java "assert" keyword, but there are two advantages:

1. If the assumption doesn't hold, it throws and AdempiereException, which adempiere itself can handle (display to user, create AD_Issue etc) much better than the AssertionError that would be thrown by assert.
2. Assumptions are always checked, not only when the "-ea" cmd-line parameter is used. I think that this is more suitable for an ERP system, because of the bigger complexity it comes with.
Plus, for me it turned you that I never had to access the DB to check my assumptions. Therefore, the performance impact turned out to be neglectable.

WDYT?

Best regards
Tobi

Discussion

  • Victor Perez Juarez

    Hi Tobi!

    have you some code lines as example?

    so we can see how would be used.

    kind regards
    Victor

     

Log in to post a comment.