Module com.github.zafarkhaja.semver
Class CompositeExpression
java.lang.Object
com.github.zafarkhaja.semver.expr.CompositeExpression
- All Implemented Interfaces:
Expression
,Predicate<Version>
This class implements internal DSL for the
SemVer Expressions using fluent interface.
- Since:
- 0.9.0
- Author:
- Zafar Khaja <zafarkhaja@gmail.com>
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
A class with static helper methods. -
Constructor Summary
ConstructorsConstructorDescriptionConstructs aCompositeExpression
with an underlyingExpression
. -
Method Summary
Modifier and TypeMethodDescriptionand
(Expression expr) Adds anotherExpression
toCompositeExpression
usingAnd
logical expression.boolean
Interprets the expression.boolean
Interprets the expression.or
(Expression expr) Adds anotherExpression
toCompositeExpression
usingOr
logical expression.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.github.zafarkhaja.semver.expr.Expression
test
-
Constructor Details
-
CompositeExpression
Constructs aCompositeExpression
with an underlyingExpression
.- Parameters:
expr
- the underlying expression
-
-
Method Details
-
and
Adds anotherExpression
toCompositeExpression
usingAnd
logical expression.- Parameters:
expr
- an expression to add- Returns:
- this
CompositeExpression
-
or
Adds anotherExpression
toCompositeExpression
usingOr
logical expression.- Parameters:
expr
- an expression to add- Returns:
- this
CompositeExpression
-
interpret
Interprets the expression.- Parameters:
version
- aVersion
string to interpret against- Returns:
- the result of the expression interpretation
- Throws:
IllegalArgumentException
- if the input string isNULL
or emptyParseException
- when invalid version string is providedUnexpectedCharacterException
- is a special case ofParseException
-
interpret
Interprets the expression.- Specified by:
interpret
in interfaceExpression
- Parameters:
version
- the version to interpret against- Returns:
- the result of the expression interpretation
-