Class QueryConstraints
- java.lang.Object
-
- com.github.collinalpert.java2db.queries.QueryConstraints
-
public class QueryConstraints extends java.lang.ObjectA class which administers default query constraints set for entities.- Author:
- Collin Alpert
-
-
Constructor Summary
Constructors Constructor Description QueryConstraints()
-
Method Summary
Modifier and Type Method Description static <E extends BaseEntity>
voidaddConstraint(java.lang.Class<E> clazz, com.github.collinalpert.lambda2sql.functions.SqlPredicate<E> predicate)Adds a query constraint to a query made with a certain entity.static <E extends BaseEntity>
com.github.collinalpert.lambda2sql.functions.SqlPredicate<E>getConstraints(java.lang.Class<E> clazz)Retrieves a compositionSqlPredicatefor all constraints that have been added for a class or any superclass of it.
-
-
-
Method Detail
-
getConstraints
public static <E extends BaseEntity> com.github.collinalpert.lambda2sql.functions.SqlPredicate<E> getConstraints(java.lang.Class<E> clazz)
Retrieves a compositionSqlPredicatefor all constraints that have been added for a class or any superclass of it.- Type Parameters:
E- The type of the class to get the constraints for.- Parameters:
clazz- The class to retrieve query constraints from.- Returns:
- A
SqlPredicatedescribing the added constraints.
-
addConstraint
public static <E extends BaseEntity> void addConstraint(java.lang.Class<E> clazz, com.github.collinalpert.lambda2sql.functions.SqlPredicate<E> predicate)
Adds a query constraint to a query made with a certain entity. This means that any query made with this entity will include thispredicate.- Type Parameters:
E- The type of the entity.- Parameters:
clazz- The entity to add the constraint to.predicate- The constraint.
-
-