package com.ecep.contract.util;

import com.ecep.contract.service.SysConfService;

import javafx.beans.property.SimpleIntegerProperty;

public class IntegerConfigProperty extends SimpleIntegerProperty
//        implements Property<Integer>
{
    private final String key;
    private final SysConfService service;

    public IntegerConfigProperty(String key, SysConfService service) {
        super(service.getInt(key));
        this.key = key;
        this.service = service;
    }


    @Override
    protected void invalidated() {
        super.invalidated();
        service.set(key, Integer.toString(get()));
    }
}
