Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    Norbert Podsadowski
    @Norbo11
    you now need to save value to a local variable
    and include that in the constructor call
    it seems like a small change on the code generation side? I'm probably missing something obvious that makes this a non-trivial change
    Filip Hrisafov
    @filiphr
    Exactly everywhere where we do setX(value) we need to save to a local variable
    What is not trivial is the way that the code is generated. It is a bit more involved that just calling setX since it encapsulates conversions as well
    There is this SourceRHS which is the right hand size
    And there is also the accessors which we are using in the java model that we have
    Michel Jung
    @micheljung

    Hi there. Shouldn't this work?

    import lombok.Data;
    import org.mapstruct.Mapper;
    import org.mapstruct.Mapping;
    import org.mapstruct.Named;
    
    @Mapper
    public interface TestMapper {
    
      @Mapping(target = "field", qualifiedByName = "mapField")
      Test map(String string);
    
      @Named("mapField")
      default String mapField(String string) {
        return string.toUpperCase();
      }
    
      @Data
      class Test {
        private String field;
      }
    }

    I get Unmapped target property: "field".

    Filip Hrisafov
    @filiphr
    Which version of MapStruct and Lombok?
    Harish Kumar
    @harishhub
    Hi there shouldn't this work ?

    @Mapper(componentModel = "spring", uses = WirelessNetworkMapper.class, injectionStrategy = InjectionStrategy.CONSTRUCTOR)
    public interface WirelessSyncSecurityMapper
    {

    WirelessSyncSecurityEntity modelToEntity(WirelessSyncSecurity model);
    
    
    WirelessSyncSecurity entityToModel(WirelessSyncSecurityEntity entity);

    }

    i am using 1.3.1.Final
    Harish Kumar
    @harishhub
    but this class is abstract WirelessNetworkMapper.class
    Filip Hrisafov
    @filiphr
    What kind of error do you get?
    Harish Kumar
    @harishhub
    i get a stack overflow error

    and here is mapper which utilises this mapper

    @Mapper(uses = { WirelessSyncSecurityMapper.class, AbstractSpotEntity.class })
    public abstract class WirelessNetworkMapper

    and when I use this class in the uses attribute in here "public interface WirelessSyncSecurityMapper "

    I get error saying expecting paramterless constructor in WirelessSyncSecurityEntity

    Filip Hrisafov
    @filiphr
    If you are using the spring componentModel you should use it for all of your mappers
    You can't mix and match
    Harish Kumar
    @harishhub
    you mean i have to pass componentModel = "spring" in every mapper that i use?
    or only where I want to use the constructor injection
    yes iam using spring
    Filip Hrisafov
    @filiphr
    In every mapper
    Either you use Spring for all your mappers or you don't
    Harish Kumar
    @harishhub
    oh ok
    didn't know that
    @filiphr but i dont see any componentModel for this class, i dont know why
    Harish Kumar
    @harishhub
    i am sorry its an interface
    The config has it
    Marcel Overdijk
    @marceloverdijk
    I'm wondering is mapstruct/mapstruct#73 being worked on or is it planned for the future?
    Alexandre Rocha
    @alexandrececchin
    Hey Folks, I've upgraded my IntelliJ version and spring boot also. Now my gradle assemble task is generating my impl classes into 2 different folders and I can't find out why this is happening. Anyone else here has faced this before?
    Filip Hrisafov
    @filiphr
    @marceloverdijk Have a look at the discussion from https://gitter.im/mapstruct/mapstruct-users?at=5de5024dd75ad3721d3cb5f6.
    TLDR: I've done some work and it is in a branch. We want that issue to be part of the next release of MapStruct (it is the most requested issue). I am a bit tight with time, but I am able to help out people if they are willing to step up and help us out :)
    sunsande
    @sunsande
    Hi there, I have a mapstruct issue. I've read the manual, stack-overflow, etc. but could not find any answer. Is it OK to post it here - I created a simple example but it is like 50 lines of code so that's way I'm asking before flooding the chat ...
    sunsande
    @sunsande
    well , no one said NO , so I 'll try it
    Raimund Klein
    @Chessray
    @sunsande Maybe put it on StackOverflow and just post a link here, that's what I usually do.
    sunsande
    @sunsande
    oh ok thanks Reimund ... I was just about to press the Enter :)
    Alexandre Rocha
    @alexandrececchin
    @sunsande I would suggest to you to take a look at https://mapstruct.org/documentation/stable/reference/html/#mapping-collections and https://mapstruct.org/documentation/stable/reference/html/#_customizing_mappings>
    Because the last time I had such an issue as you're facing, I used a decorator to fix it.
    Naveen Reddy
    @mnreddy7
    Hi
    Is there a way to invoke mapstruct plugin from command line using maven
    Because my project has 1000s of sources. So in order to verify mapping, build is taking more time. It will only get higher with more and more mappers
    I was wondering if there is any maven command line command which generates mapping code only for specified file instead of compiling whole jar.
    Filip Hrisafov
    @filiphr
    MapStruct is not a maven plugin, it is an annotation processor. So doing mvn compile triggers it
    What does slow mean?
    How long does it take to compile the mappers?
    Naveen Reddy
    @mnreddy7
    Not about mapper. Our jar has other source files. About 1000. So if want run test on single mapper, I have to run mvn compile which itself takes about 5 mins.
    I w
    Hung B.
    @hungbang
    Hello everyone