Timetrack application
DomainException is a subclass of Exception, it requires to be handled on the presentation layer.
-
Null checking - when instantiating an domain object, throws NullPointerException through guava Preconditions class.
-
Validation - when instantiating an domain object, checking if the request to the application is correct, general mechanism to handle all kinds of validations, requires only data from single, throws InvalidEntityException a subclass of DomainException.
TO-DO: How to validate composite objects?
-
Single application rule - when executing business logic, assumes that request is correct, requires getting data from the repository to check, throws subclass of DomainException.
-
Multiple application rule - when executing business logic, assumes that request is correct, handled problematically by creating collections of value object, throws subclass of DomainException.
Checking cost grows with every level. First rule is the cheapest. Last one is most expensive.