Knight95
Knight95

Reputation: 73

Wrapper Boolean VS Primitive boolean

I am using Lombok.

This is how my Metadata file looks like.

package com.some.test.check.meta;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;

@NoArgsConstructor
@AllArgsConstructor
@Getter
public class CSVSourceProbeMetaData {
    private boolean backupEnabled;
    private String streamingDir;
    private String filePattern;
}

But when I try to access backupEnabled from here in the class file, it doesn't give me suggestions and it is red.

public Object execute() {
        boolean backupEnabled = csvSourceProbeMetaData.get_______();
        String streamingDir = csvSourceProbeMetaData.getStreamingDir();

But when I use Wrapper class it works fine. Is this because I cannot use primitive boolean here or any other reason?

Upvotes: 0

Views: 622

Answers (1)

AMA
AMA

Reputation: 427

The getter method name for boolean will start with is not get so try isBackupEnabled this will work with you

Check this for more details https://www.baeldung.com/lombok-getter-boolean

Upvotes: 2

Related Questions