Class WrappedResult

Object
WrappedResult

public class WrappedResult extends Object
Makes sure that a result appears "as-is" in the logic result. This is useful e.g., in the case where a logic result is a list or array and should appear as true JSON list in the logic response as well.

Create an instance with api.wrap(result) and return it from a logic element.

Example:


 def rows = [
         [sku: "P-100", price: 12.50],
         [sku: "P-200", price: 18.00]
 ]

 return api.wrap(rows)
 
Since:
3.2.50 - Mojito
See Also:
  • Constructor Details

    • WrappedResult

      public WrappedResult(Object result)
      Creates a wrapper around the given result.

      A logic gets an instance from api.wrap(result) instead of calling this constructor.

      Parameters:
      result - The value to pass to the logic response unchanged.
  • Method Details

    • getResult

      public Object getResult()
      Returns the wrapped value.
      Returns:
      The value this wrapper was created with.