After using C ++, I got used to the concept of an Identifier that can be used with a class for this type, provides type safety and does not have runtime overhead (the actual size is the size of the primitive). I want to do something like this, so I will not be mistaken, for example:
personDao.find(book.getId());
personDao.find(book.getOwnerId());
Possible solutions that I don't like:
Does anyone know a better way?
Is there a library with a utility like this? Does this realize excess?
And the best thing is, can this be done in Java without the overhead of the object, as in C ++?
source
share