I'm trying to use mapstruct on Android for mapping immutable AutoValue objects, but cannot for the live of me figure out how. There are no examples in mapstruct-examples which contain 'InjectionStrategy.CONSTRUCTOR' or '@MapperConfig' or 'immutable' or '@autovalue'. I found one class container 'builder' namely ProtobufAccessorNamingStrategy but that didn't help me much.
Nor could I find anything helpful on stackoverflow. The documentation mentions builder but not how to use it, it mentions BuilderProvider which is not mentioned elsewhere in reference-guide.
When trying to create a mapper for AutoValue I get
The return type com.example.mapstructtest.model.MyValueDto is an abstract class or interface. Provide a non abstract / non interface result type or a factory method.
The closest I've gotten was
@Mapper(injectionStrategy = InjectionStrategy.CONSTRUCTOR, uses = {MyValue.Builder.class, MyValueDto.Builder.class})
but then the impl generated tries to do this which is not the autovallue it should use create method
private final Builder builder1 = new Builder();
I'll ask elsewhere for help. The purpose if this is to point to the lack of documentation.
Best Alex
Ps: I've forked an https://github.com/arberg/mapstruct-test which is an example project for mapstruct for Android. I could update it with AutoValue example, and it could also be copied into mapstruct-examples.
I'm trying to use mapstruct on Android for mapping immutable AutoValue objects, but cannot for the live of me figure out how. There are no examples in mapstruct-examples which contain 'InjectionStrategy.CONSTRUCTOR' or '@MapperConfig' or 'immutable' or '@autovalue'. I found one class container 'builder' namely ProtobufAccessorNamingStrategy but that didn't help me much.
Nor could I find anything helpful on stackoverflow. The documentation mentions builder but not how to use it, it mentions BuilderProvider which is not mentioned elsewhere in reference-guide.
When trying to create a mapper for AutoValue I get
The return type com.example.mapstructtest.model.MyValueDto is an abstract class or interface. Provide a non abstract / non interface result type or a factory method.
The closest I've gotten was
@Mapper(injectionStrategy = InjectionStrategy.CONSTRUCTOR, uses = {MyValue.Builder.class, MyValueDto.Builder.class})
but then the impl generated tries to do this which is not the autovallue it should use create method
private final Builder builder1 = new Builder();
I'll ask elsewhere for help. The purpose if this is to point to the lack of documentation.
Best Alex
Ps: I've forked an https://github.com/arberg/mapstruct-test which is an example project for mapstruct for Android. I could update it with AutoValue example, and it could also be copied into mapstruct-examples.