Class Lambda2Sql
java.lang.Object
com.github.collinalpert.lambda2sql.Lambda2Sql
public class Lambda2Sql
extends java.lang.Object
A utility class for converting java lambdas to SQL.
-
Constructor Summary
Constructors Constructor Description Lambda2Sql() -
Method Summary
Modifier and Type Method Description static java.lang.StringtoSql(SerializedFunctionalInterface functionalInterface)static java.lang.StringtoSql(SerializedFunctionalInterface functionalInterface, java.lang.String tableName)static java.lang.StringtoSql(SerializedFunctionalInterface functionalInterface, java.lang.String tableName, boolean withBackticks)Converts a lambda expression to SQL.
-
Constructor Details
-
Lambda2Sql
public Lambda2Sql()
-
-
Method Details
-
toSql
public static java.lang.String toSql(SerializedFunctionalInterface functionalInterface, java.lang.String tableName, boolean withBackticks)Converts a lambda expression to SQL.
Becomes a string:person -> person.getAge() > 50 && person.isActive()
Supported operators:"age > 50 AND active">,>=,<,<=,=,!=,&&,||,!- Parameters:
functionalInterface- AFunctionalInterfacelambda to convert.tableName- The table name which the column belongs to. This will explicitly reference the column. It is optional to specify this.withBackticks- Specifies if the table and the column name should be escaped with backticks. The default behavior istrue.- Returns:
- A
Stringdescribing the SQL where condition.
-
toSql
public static java.lang.String toSql(SerializedFunctionalInterface functionalInterface, java.lang.String tableName) -
toSql
-