package com.storlead.framework.common.util.generate;

/**
 * @program: sp-project-system
 * @description:
 * @author: chenkq
 * @create: 2021-09-11 14:18
 */
public class DefaultIdentifierGenerator implements IdentifierGenerator {

    private final Sequence sequence;

    public DefaultIdentifierGenerator() {
        this.sequence = new Sequence();
    }

    public DefaultIdentifierGenerator(long workerId, long dataCenterId) {
        this.sequence = new Sequence(workerId, dataCenterId);
    }

    public DefaultIdentifierGenerator(Sequence sequence) {
        this.sequence = sequence;
    }

    @Override
    public Long nextId() {
        return this.sequence.nextId();
    }
}
