Boolean as get in 1.2.2

19 views
Skip to first unread message

Brad Huggins

unread,
Mar 11, 2015, 1:55:52 PM3/11/15
to jmapper-...@googlegroups.com
I am using Lombok to create my getters and setters and want to avoid

ERROR com.googlecode.jmapper.JMapper - MalformedBeanException: isIsCategorized method not found 

is there some setting or something to make it use getIsCategorized?

Brad Huggins

unread,
Mar 11, 2015, 4:56:40 PM3/11/15
to jmapper-...@googlegroups.com
Here is some additional info just incase it's useful:

@Data
@JGlobalMap(excluded = {"serialVersionUID", "mapper"})
public final class ReleaseDto implements Serializable {
private static final long serialVersionUID = 1L;
    private static final JMapper<ReleaseDto,Releases> mapper = new JMapper<ReleaseDto,Releases>(ReleaseDto.class, Releases.class);

    private boolean isCategorized;
private boolean isHashed;
private boolean isRenamed;
private boolean isRequestId;

    public static ReleaseDto newInstance(Releases release) {
ReleaseDto releaseDto = mapper.getDestination(release);
      
      return releaseDto;    
    }
}


to make it work I added to the DTO:
public boolean isIsCategorized() { return this.isCategorized;};
public boolean isIsHashed() { return this.isHashed;};
public boolean isIsRenamed() { return this.isRenamed;};
public boolean isIsRequestId() { return this.isRequestId;};

public void setIsCategorized(boolean isCategorized) { this.isCategorized = isCategorized;};
public void setIsHashed(boolean isHashed) { this.isHashed = isHashed;};
public void setIsRenamed(boolean isRenamed) { this.isRenamed = isRenamed;};
public void setIsRequestId(boolean isRequestId) { this.isRequestId = isRequestId;};

and I added to the Domain Object:
public boolean isIsCategorized() { return this.isCategorized;};
public boolean isIsHashed() { return this.isHashed;};
public boolean isIsRenamed() { return this.isRenamed;};
public boolean isIsRequestId() { return this.isRequestId;};

It appears Lombok generates the following:
public boolean isCategorized() { return isCategorized; }
public void setCategorized(boolean isCategorized) { this.isCategorized = isCategorized; }


Thanks,

Brad



Alessandro Vurro

unread,
Mar 12, 2015, 5:26:15 AM3/12/15
to jmapper-...@googlegroups.com
Hi Brad,

JMapper verifies that exists a method with a "get" or "is" prefixes, the problem is that this method doesn't exists.

Lombok injects methods in a way that I do not know.

Test yourself to write getIsCategorized(), i can assure you that this prefixes are handled at present.
Reply all
Reply to author
Forward
0 new messages