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
Wiki-Page: http://www.adempiere.com/Feature:_Assume
Hi Tobi!
have you some code lines as example?
so we can see how would be used.
kind regards
Victor
Hi Victor,
yes, I here is a changeset showing three examples on how it could be used;
http://adempiere.hg.sourceforge.net/hgweb/adempiere/adempiere/rev/492abbedd43e
Best regards
Tobi