Roman margolin
Roman margolin

Reputation: 97

Chimeny scala - validate source

i want to use chimney as Scala automapper , and in library like mapstruct I got unmappedSourcePolicy where is one the field of source were not use , the code will not compile. If there is any way I can achieve this in chimney or any oher scala auto mapper library?

public class Demo {
    private int x;
    private int y;
    public int getX() {
        return x;
    }
    public void setX(int x) {
        this.x = x;
    }
    public int getY() {
        return y;
    }
    public void setY(int y) {
        this.y = y;
    }
}

public class Demo2 {
    private int x;
    public int getX() {
        return x;
    }
    public void setX(int x) {
        this.x = x;
    }
}

@org.mapstruct.Mapper(
        unmappedSourcePolicy = ReportingPolicy.ERROR
)
public interface  Mapper {

   Mapper INSTANCE = Mappers.getMapper( Mapper.class );

   public  Demo2 map(Demo demo);
}

In this case when i run clean install in mvn i getting next error:

Unmapped source property: "y". Can it be achieve in chimney or any other scala auto mapper?

Upvotes: 0

Views: 216

Answers (0)

Related Questions