I have a DAO that brings data from a web service, that data comes in a string, in the likes of:
*NAME|John Doe *DATEOFBIRTH|1978-23-01*ID|anID123 (...)
I have a DTO that I wanna fill up with the parsed data (the DTO has fields in the like of name, birthdate, id...)
So, my question is, what is the best practice:
- Parsing the string in the DAO to fill up the DTO
- Passing the data string to the DTO and the DTO itself parse the string and fill itself up
- Do the parsing in an utility class that would receive the string and return the fill up DTO
DAO: Data Access Object
DTO: Data Transfer Object
Note: I kept this language agnostic so it could be useful to anyone using object oriented languages, but, in my particular case, I'm using Java.