Skip to content

公式返回数字类型都是Double,能否返回实际类型 #19

@ZhangBohan

Description

@ZhangBohan

例如

AlgorithmEngine engine = new AlgorithmEngine();
Operand operand = engine.Evaluate("year(now())");

Object result;
switch (operand.Type()) {
      case BOOLEAN: result = operand.BooleanValue();
      case ARRARY: result = operand.ArrayValue();
      case DATE: result = operand.DateValue();
      case JSON: result = operand.JsonValue();
      case TEXT: result = operand.TextValue();
      case NUMBER: result = operand.NumberValue();
      default: result = null;
  }
assertEquals(2023, result);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions