Class CompositeExpression

java.lang.Object
com.github.zafarkhaja.semver.expr.CompositeExpression
All Implemented Interfaces:
Expression, Predicate<Version>

public class CompositeExpression extends Object implements Expression
This class implements internal DSL for the SemVer Expressions using fluent interface.
Since:
0.9.0
Author:
Zafar Khaja <zafarkhaja@gmail.com>
  • Constructor Details

    • CompositeExpression

      public CompositeExpression(Expression expr)
      Constructs a CompositeExpression with an underlying Expression.
      Parameters:
      expr - the underlying expression
  • Method Details

    • and

      public CompositeExpression and(Expression expr)
      Adds another Expression to CompositeExpression using And logical expression.
      Parameters:
      expr - an expression to add
      Returns:
      this CompositeExpression
    • or

      public CompositeExpression or(Expression expr)
      Adds another Expression to CompositeExpression using Or logical expression.
      Parameters:
      expr - an expression to add
      Returns:
      this CompositeExpression
    • interpret

      public boolean interpret(String version)
      Interprets the expression.
      Parameters:
      version - a Version string to interpret against
      Returns:
      the result of the expression interpretation
      Throws:
      IllegalArgumentException - if the input string is NULL or empty
      ParseException - when invalid version string is provided
      UnexpectedCharacterException - is a special case of ParseException
    • interpret

      public boolean interpret(Version version)
      Interprets the expression.
      Specified by:
      interpret in interface Expression
      Parameters:
      version - the version to interpret against
      Returns:
      the result of the expression interpretation