In the 3 stack layer world of Java EE (domain, DAO, services)
What do you can a domain helper object that is meant to help the user interface world. For example:
domain.Users
represents users who post a message to a forum, such users can submit a message anonymously. When a service finds that a user needs to be “anonymous” via a piece of logic a
xyz.Anonymous
class is created and the user reference is passed to it via the constructor:
Anonymous anon = new Anonymous(user);
The anonymous class is meant for the user interface.
However, Anonymous is not a domain object because it does not have a DAO associated with it. So what should xyz be?
Domain objects have got nothing to do with persistence. Domain objects are objects which model the domain. If the domain includes the idea of anonymous posts, then there will be domain objects which cater for that.
Some domain objects may be persistent, but don’t get hung up on that.
Regardless, don’t split your classes into packages simply along layer lines, do it by functional area. So, one package for users and identity, another for messages, another for chatrooms, etc. If you have code which is generic across a whole layer, then sure, put that in a layer-specific package, but that doesn’t need to be the default.