插件开发工具库,推荐依赖该工具库。
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

46 lines
1.7 KiB

package com.fanruan.api.data;
import com.fr.base.TableData;
import com.fr.data.TableDataSource;
import com.fr.data.api.TableDataAssist;
import com.fr.script.Calculator;
import com.fr.stable.script.CalculatorProvider;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
* @author richie
* @version 10.0
* Created by richie on 2019-08-09
* 数据集获取工具类
*/
public class TableDataKit {
/**
* 根据名字获取数据集
* 根据以下步骤获取数据集:
* 1、先查询当前模板,是否具有该名字的数据集,如果有,则返回,如果没有,则进行第二步;
* 2、再查询服务器数据集配置,是否具有该名字的服务器数据集,如果有,则返回,如果没有,则返回null。
*
* @param cal 算子
* @param name 数据集名字
* @return 数据集
*/
public static @Nullable TableData getTableData(@NotNull CalculatorProvider cal, String name) {
return TableDataAssist.getTableData((Calculator) cal, name);
}
/**
* 根据名字获取数据集
* 根据以下步骤获取数据集:
* 1、先查询当前模板,是否具有该名字的数据集,如果有,则返回,如果没有,则进行第二步;
* 2、再查询服务器数据集配置,是否具有该名字的服务器数据集,如果有,则返回,如果没有,则返回null。
*
* @param source 模板
* @param name 数据集名字
* @return 数据集
*/
public static @Nullable TableData getTableData(@NotNull TableDataSource source, String name) {
return TableDataAssist.getTableData(source, name);
}
}