jmapper-framework / jmapper-core

Elegance, high performance and robustness all in one java bean mapper
http://jmapper-framework.github.io/jmapper-core
Apache License 2.0
227 stars 41 forks source link

No setter/getter for field mapping #71

Closed tokazio closed 7 years ago

tokazio commented 7 years ago

How to map field when it doesn't have a getter/setter ?

Source

private Long id;

public Long getId() {
    return id;
}

public void setId(final Long id) {
    this.id = id;
}

Destination

@JMap
private Long id;

Got:

com.googlecode.jmapper.exceptions.MalformedBeanException: setId method not found in NFGrandTotalPeriode Class for the id field, checks the signature.

avurro commented 7 years ago

Hi @tokazio,

Setter and getter methods are required, but you can apply a workaround using custom accessor methods.

tokazio commented 7 years ago

Yes i'm aware of that. But i'm searching for an automatic field setting system. I don't want the object (DTO) to expose setters or i want to choose the public ones. But private setters aren't automatically detected too.