[]
Serializable, Comparable<FunctionValueType>, Constable将此枚举与 Parameter 和 CustomFunction 一起使用,可以声明自定义函数接受或返回的值种类,例如数字、文本、逻辑值、标量变体或对象。
class DelayFunction extends AsyncCustomFunction {
DelayFunction() {
super("DELAY_SAMPLE", FunctionValueType.Number,
new Parameter[] { new Parameter(FunctionValueType.Number) });
}
public CompletableFuture<Object> evaluateAsync(Object[] arguments, ICalcContext context) {
return CompletableFuture.completedFuture(arguments[0]);
}
}
AsyncCustomFunction function = new DelayFunction();
Workbook.AddCustomFunction(function, true);
worksheet.getRange("A1").setFormula2("=DELAY_SAMPLE(10)");
workbook.calculate();
workbook.waitForCalculationToFinish();
Object delayedValue = worksheet.getRange("A1").getValue();
Enum.EnumDesc<E extends Enum<E>>Array 或 CalcReference。CalcError, or null.static FunctionValueTypeforValue(int value) intgetValue()static FunctionValueTypestatic FunctionValueType[]values()CalcError, or null.Array 或 CalcReference。如果参数为 retval 或 acceptCustomObjects,该值也可以是自定义对象。
name - the name of the enum constant to be returned.IllegalArgumentException - if this enum class has no constant with the specified nameNullPointerException - if the argument is nullvalue - The zero-based numeric value.