Class ConditionalFunctions.If

java.lang.Object
org.apache.juneau.commons.svl.TypedFunction
org.apache.juneau.commons.svl.functions.ConditionalFunctions.If
All Implemented Interfaces:
VarFunction
Enclosing class:
ConditionalFunctions

public static class ConditionalFunctions.If extends TypedFunction
#{if(cond, then, else)} — replacement for the legacy $IF{...}.

Returns then if cond is truthy, else otherwise. Truthiness is explicit (no implicit truthiness).

  • Constructor Details

    • If

      public If()
  • Method Details

    • name

      public String name()
      Description copied from interface: VarFunction
      The function's invocation name as it appears between #{} and the opening parenthesis in the template. Must consist of ASCII letters, digits, and underscores; must begin with a letter.
      Returns:
      The invocation name. Never null or empty.
    • invoke

      public String invoke(boolean cond, String thenVal, String elseVal)