All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.neko233.skilltree.idGenerator.IdGenerator Maven / Gradle / Ivy

There is a newer version: 0.3.6
Show newest version
package com.neko233.skilltree.idGenerator;

import com.neko233.skilltree.annotation.Nullable;

import java.util.List;

public interface IdGenerator {

    String getName();

    /**
     * @return null = 无法获取 / long = id
     */
    @Nullable
    Long nextId() throws IdGeneratorException;

    List nextIds(int count) throws IdGeneratorException;

    /**
     * 缓存 n 个 ID
     *
     * @param count 缓存 ID 数量
     * @return 是否成功, 有些是不支持缓存的
     * @throws IdGeneratorException ID 生成异常 | id 数量用完了
     */
    boolean cacheId(int count) throws IdGeneratorException;

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy