Class CompositeExpression

  • All Implemented Interfaces:
    Expression

    public class CompositeExpression
    extends java.lang.Object
    implements Expression
    This class implements internal DSL for the SemVer Expressions using fluent interface.
    Since:
    0.9.0
    Author:
    Zafar Khaja
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  CompositeExpression.Helper
      A class with static helper methods.
    • Constructor Summary

      Constructors 
      Constructor Description
      CompositeExpression​(Expression expr)
      Constructs a CompositeExpression with an underlying Expression.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      CompositeExpression and​(Expression expr)
      Adds another Expression to CompositeExpression using And logical expression.
      boolean interpret​(Version version)
      Interprets the expression.
      boolean interpret​(java.lang.String version)
      Interprets the expression.
      CompositeExpression or​(Expression expr)
      Adds another Expression to CompositeExpression using Or logical expression.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • CompositeExpression

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

      • 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​(java.lang.String version)
        Interprets the expression.
        Parameters:
        version - a Version string to interpret against
        Returns:
        the result of the expression interpretation
        Throws:
        java.lang.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