Package org.apache.groovy.contracts.util

# Class ExpressionUtils

java.lang.Object
org.apache.groovy.contracts.util.ExpressionUtils

public final class ExpressionUtils extends Object

Internal utility class for extracting a boolean expression from the given expression or statement.

See Also:
  - `ClosureExpression`
  - `BooleanExpression`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static BooleanExpression`
  `getBooleanExpression(List<BooleanExpression> booleanExpressions)`
  Collapses the supplied boolean expressions into a single expression combined with logical AND.
  `static List<BooleanExpression>`
  `getBooleanExpression(ClosureExpression closureExpression)`
  Returns all `BooleanExpression` instances found in the given `ClosureExpression`.
  `static List<BooleanExpression>`
  `getBooleanExpressionsFromAssertionStatements(BlockStatement blockStatement)`
  Returns all `BooleanExpression` instances found in the given `BlockStatement`.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Method Details

  - ### getBooleanExpression

    public static List<BooleanExpression> getBooleanExpression(ClosureExpression closureExpression)
    Returns all `BooleanExpression` instances found in the given `ClosureExpression`.

  - ### getBooleanExpressionsFromAssertionStatements

    public static List<BooleanExpression> getBooleanExpressionsFromAssertionStatements(BlockStatement blockStatement)
    Returns all `BooleanExpression` instances found in the given `BlockStatement`.

  - ### getBooleanExpression

    public static BooleanExpression getBooleanExpression(List<BooleanExpression> booleanExpressions)
    Collapses the supplied boolean expressions into a single expression combined with logical AND.
    Parameters:
      `booleanExpressions` - the expressions to combine
    Returns:
      the combined expression, or `true` if the input is empty