Class Expression

java.lang.Object
com.github.mhewedy.expressions.Expression

public abstract class Expression extends Object
Expression class considered the base for all other expressions as well as contains factory method to build the expressions object.

So it represents the java api for the expressions

Example: We can build complex expressions and pass it to the spring data jpa ExpressionsRepository.findAll(Expressions) using the factory methods in this class as following:

 var expressions = Expression.of("lastName", Operator.$eq, "ibrahim")
         .and(Expression.or(
                 Expression.of("age", Operator.$in, 10, 20),
                 Expression.of("birthDate", Operator.$lt, LocalDate.of(1980, 1, 1)))
         ).build();
 
Then the output could be represented as:
 where lastName = "ibrahim" and (age in (10 , 20) or birth_date < "1980-01-01")
 

The Expression API also service as an intermediate representations that resides between the Expressions and the spring data JPA specifications implementation ExpressionsPredicateBuilder.