package it.integry.integrywmsnative.core.di;

import androidx.databinding.BaseObservable;

import org.parceler.Parcel;

@Parcel
public class BindableInteger  extends BaseObservable {
    Integer value;

    public Integer get() {
        return get(true);
    }

    public Integer get(boolean defaultIfNull) {

        if(value == null){
            if(defaultIfNull) return 0;
            else return null;
        } else return value;
    }

    public void set(Integer value) {
        if (!Objects.equals(this.value, value)) {
            this.value = value;
            notifyChange();
        }
    }

    public boolean isEmpty() {
        return value == null;
    }

}
