I'm implementing the DDD repository pattern (using an object database, but that is not important for the question) and in the repository there is a method like this:
Entity save(Entity entity);
Where Entity is an interface.
In the implementation, I create a proxy wrapping the received entity and overriding the getters and setters (which then write to a document) and then return it.
The point is that this proxy has to be created only if the entity is not yet proxied, but since ByteBuddy proxies do not depend on any ByteBuddy classes I don't know how to figure out whether the entity is already proxied or not.
What is the best mechanism to know if an object is already proxied by ByteBuddy?