Skip to content

Auto generated cursor class for an entity expects "get" accessor for boolean but normally the accessors for bools start with "is" #164

@RoqueCampos

Description

@RoqueCampos

Problem with the autogenerated cursor class and boolean fields.

Basics

  • ObjectBox version (are using the latest version?): 0.9.15
  • Reproducibility: always

Reproducing the bug

Description

I'm creating a simple entity with a boolean field:

@Entity
public class DemoEntity implements Serializable {

    @JsonProperty("ID")
    @Id(assignable = true)
    private Long id;

    private boolean localChecked;

    public Long getId() {
        return id;
    }

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

    public boolean isLocalChecked() {
        return localChecked;
    }

    public void setLocalChecked(boolean localChecked) {
        this.localChecked = localChecked;
    }
}

I use the shortcut from Android Studio to generate the getters and setters. The "isLocalChecked" and "setLocalChecked" functions are generated for the boolean field.

But the auto generated cursor class awaits a getLocalChecked function:

 public final long put(DemoEntity entity) {
        Long id = entity.getId();
        long __assignedId = collect004000(cursor, id != null ? id: 0, PUT_FLAG_FIRST | PUT_FLAG_COMPLETE,
                 __ID_localChecked**, entity.getLocalChecked() ? 1 : 0,**
                0, 0, 0, 0);

        entity.setId(__assignedId);

        return __assignedId;
    }

A workaround is to manually generate a "get" accessor for boolean values.

Best regards!

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions