Hello: I have an app where in a thread hierarchy (persisted entity) is modelled as follows (note that this could be a deeply nested hierarchy):
Thread
{
private key;
private rootKey;
private parentKey;
.. getters ..
.. setters ..
}
I have a DTO which has the following structure
ThreadDTO
{
private key;
private rootKey;
private parentKey;
ArrayList<ThreadDTO> childThreads;
... getters ...
... setters ...
}
I would like to convert the entity instances into the DTO. Are there any standard algorithms / best practices available that can be optimally be used for doing this transformation ? Any feedback would be appreciated..