Android-CleanArchitecture icon indicating copy to clipboard operation
Android-CleanArchitecture copied to clipboard

A question about datamapper

Open NerdAnonymous opened this issue 8 years ago • 2 comments

For demo, The UserEntity only basic types Member variable And it‘s easy to transform. If it contains other objects,What's the best solution?

NerdAnonymous avatar Nov 08 '17 14:11 NerdAnonymous

@blackguardMask you can add extra dependencies in your constructor (mappers) which will map these objects. eg.

@Inject
public Mapper(Mapper1, Mapper2) {
}

Of course you should think if it's reasonable to do it. eg. if you have just a small object I don't think that it worths to create a whole new mapper for this, but this is a personal preference.

spirosoik avatar Nov 09 '17 09:11 spirosoik

@spirosoik Well, it looks like i have to think about it.Thank you for your answer and forgive me for my poor English.

NerdAnonymous avatar Nov 09 '17 10:11 NerdAnonymous