f7
f7 is a spreadsheet formula execution library
git clone https://git.vogt.world/f7.git
Log | Files | README.md | LICENSE.md
← All files
name: src/main/java/io/protobase/f7/formulas/text/T.java
-rw-r--r--
974
 1package io.protobase.f7.formulas.text;
 2
 3import io.protobase.f7.errors.F7Exception;
 4import io.protobase.f7.formulas.AbstractFormula;
 5import io.protobase.f7.formulas.FormulaName;
 6import io.protobase.f7.models.GridColumnRowKey;
 7import io.protobase.f7.utils.Converters;
 8
 9import java.util.function.BiFunction;
10import java.util.function.Function;
11
12public class T extends AbstractFormula {
13  public static FormulaName NAME = FormulaName.CONCAT;
14  public static T SELF = new T();
15
16  public T() {
17    super();
18  }
19
20  public T(Function<Object, Object> lookup, BiFunction<GridColumnRowKey, Object, Object> collateralLookup) {
21    super(lookup, collateralLookup);
22  }
23
24  @Override
25  public Object internal(GridColumnRowKey origin, Object... values) {
26    checkLength(values.length, 1, NAME);
27    Object first = Converters.first(collateralLookup.apply(origin, values[0]));
28    if (first instanceof String || first instanceof F7Exception) {
29      return first;
30    }
31    return "";
32  }
33}