Class OpFunctions.Neg

java.lang.Object
org.apache.juneau.commons.svl.functions.OpFunctions.Neg
All Implemented Interfaces:
VarFunction
Enclosing class:
OpFunctions

public static class OpFunctions.Neg extends Object
$op.neg.
  • Constructor Details

    • Neg

      public Neg()
      Constructor.
  • 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.
      Specified by:
      name in interface VarFunction
      Returns:
      The invocation name. Never null or empty.
    • minArity

      public int minArity()
      Description copied from interface: VarFunction
      Minimum argument count this function accepts.
      Specified by:
      minArity in interface VarFunction
      Returns:
      The minimum number of args. 0 means the function may be called with no args. Returns -1 for "any number of args" — equivalent to declaring minArity == 0 && maxArity == Integer.MAX_VALUE.
    • maxArity

      public int maxArity()
      Description copied from interface: VarFunction
      Maximum argument count this function accepts.
      Specified by:
      maxArity in interface VarFunction
      Returns:
      The maximum number of args, or Integer.MAX_VALUE for unbounded variadic functions.
    • invokeValue

      public Object invokeValue(VarResolverSession session, List<Object> args)
      Description copied from interface: VarFunction
      Typed variant of VarFunction.invoke(VarResolverSession, List) used by #{...} expressions.

      The default delegates to VarFunction.invoke(VarResolverSession, List).

      Specified by:
      invokeValue in interface VarFunction
      Parameters:
      session - The session.
      args - The already-evaluated arguments (typed values, not necessarily strings).
      Returns:
      The result; null means absent.
    • invoke

      public String invoke(VarResolverSession session, List<Object> args)
      Description copied from interface: VarFunction
      Invokes this function with already-resolved, type-coerced arguments.

      The runtime resolves each #{...} arg template against the session, then coerces the resolved string to the target Java type via ArgCoercer. The resulting List<Object> is passed in here.

      Specified by:
      invoke in interface VarFunction
      Parameters:
      session - The current resolver session. Must not be null.
      args - The coerced arguments. Size is in [minArity(), maxArity()]. Each element is the type the function expects per its signature; for variadic / Object-typed slots, elements remain String.
      Returns:
      The function's result as a String. May be empty but should not be null (the runtime treats null as the empty string for SVL output).