Hi,
i would like to implement a setter for a double value that checks the value
against a range of values. If the value isn't in the range, an Exception
should be thrown.
I simply used a BasicType in model.design:
BasicType Rating {
!immutable
Double value;
}
The BasicType Rating is used like this:
Entity Movie {
scaffold
String movieName key;
String edition key;
reference @Rating rating nullable;
}
The range is fix (0 to 10).
My first implementation was to throw a SystemException, because if I used a
checked exception (ApplicationException) the setter would need a throws
declaration. That isn't possible as far as I know because the generated
RatingBase has no throws declaration for the setter...
But it isn't nice when a SystemError is displayed only because the user
entered a wrong value. So i would like to catch the exception and handle it
by showing the user a info message.
Where do I have to add this code or is there a better way to handle the
validation of the value?
Furthermore I was wondering myself why there is always an ID created for an
entity in the db and not just taken e.g. in my example movieName and edition
as db keys?
Greets, Ralf
--
View this message in context:
http://www.nabble.com/checking-against-range-of-values-tp20293432s17564p20293432.html
Sent from the Fornax-Platform mailing list archive at Nabble.com.
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Fornax-developer mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/fornax-developer