package it.integry.integrywmsnative.core.di;

import androidx.databinding.BaseObservable;

import org.parceler.Parcel;

@Parcel
public class BindableFloat extends BaseObservable {
    Float value;

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

    public Float get(boolean defaultIfNull) {

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

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

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

}
