Class CompositeExpression
- java.lang.Object
-
- com.github.zafarkhaja.semver.expr.CompositeExpression
-
- All Implemented Interfaces:
Expression
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
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classCompositeExpression.HelperA class with static helper methods.
-
Constructor Summary
Constructors Constructor Description CompositeExpression(Expression expr)Constructs aCompositeExpressionwith an underlyingExpression.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CompositeExpressionand(Expression expr)Adds anotherExpressiontoCompositeExpressionusingAndlogical expression.booleaninterpret(Version version)Interprets the expression.booleaninterpret(String version)Interprets the expression.CompositeExpressionor(Expression expr)Adds anotherExpressiontoCompositeExpressionusingOrlogical expression.
-
-
-
Constructor Detail
-
CompositeExpression
public CompositeExpression(Expression expr)
Constructs aCompositeExpressionwith an underlyingExpression.- Parameters:
expr- the underlying expression
-
-
Method Detail
-
and
public CompositeExpression and(Expression expr)
Adds anotherExpressiontoCompositeExpressionusingAndlogical expression.- Parameters:
expr- an expression to add- Returns:
- this
CompositeExpression
-
or
public CompositeExpression or(Expression expr)
Adds anotherExpressiontoCompositeExpressionusingOrlogical expression.- Parameters:
expr- an expression to add- Returns:
- this
CompositeExpression
-
interpret
public boolean interpret(String version)
Interprets the expression.- Parameters:
version- aVersionstring to interpret against- Returns:
- the result of the expression interpretation
- Throws:
IllegalArgumentException- if the input string isNULLor emptyParseException- when invalid version string is providedUnexpectedCharacterException- is a special case ofParseException
-
interpret
public boolean interpret(Version version)
Interprets the expression.- Specified by:
interpretin interfaceExpression- Parameters:
version- the version to interpret against- Returns:
- the result of the expression interpretation
-
-