#2345 - Rename Database.getExpressionFactory() to expressionFactory with deprecation

This commit is contained in:
rbygrave committed 2021-09-03 09:46:04 +12:00
1 parent 058e16d1a8
commit 921ee9f8a1
2 files changed
+58 -47

No files matched your search

+18 -2
View File
@@ -126,10 +126,18 @@ public final class DB {
* an expression that uses OR like Expression e = Expr.or(..., ...); * an expression that uses OR like Expression e = Expr.or(..., ...);
* </p> * </p>
*/ */
public static ExpressionFactory getExpressionFactory() { public static ExpressionFactory expressionFactory() {
return getDefault().expressionFactory(); return getDefault().expressionFactory();
} }
/**
* Deprecated migrate to expressionFactory().
*/
@Deprecated
public static ExpressionFactory getExpressionFactory() {
return expressionFactory();
}
/** /**
* Return the next identity value for a given bean type. * Return the next identity value for a given bean type.
* <p> * <p>
@@ -1261,10 +1269,18 @@ public final class DB {
* Return the BackgroundExecutor service for asynchronous processing of * Return the BackgroundExecutor service for asynchronous processing of
* queries. * queries.
*/ */
public static BackgroundExecutor getBackgroundExecutor() { public static BackgroundExecutor backgroundExecutor() {
return getDefault().backgroundExecutor(); return getDefault().backgroundExecutor();
} }
/**
* Deprecated migrate to backgroundExecutor().
*/
@Deprecated
public static BackgroundExecutor getBackgroundExecutor() {
return backgroundExecutor();
}
/** /**
* Return the JsonContext for reading/writing JSON. * Return the JsonContext for reading/writing JSON.
*/ */
+40 -45
View File
@@ -16,7 +16,7 @@ import java.util.Map;
* This provides a convenient way to create expressions for the default * This provides a convenient way to create expressions for the default
* database. * database.
* <p> * <p>
* See also {@link DB#getExpressionFactory()} * See also {@link DB#expressionFactory()}
* </p> * </p>
* <p> * <p>
* Creates standard common expressions for using in a Query Where or Having * Creates standard common expressions for using in a Query Where or Having
@@ -34,14 +34,14 @@ public class Expr {
* Equal To - property equal to the given value. * Equal To - property equal to the given value.
*/ */
public static Expression eq(String propertyName, Object value) { public static Expression eq(String propertyName, Object value) {
return DB.getExpressionFactory().eq(propertyName, value); return DB.expressionFactory().eq(propertyName, value);
} }
/** /**
* Not Equal To - property not equal to the given value. * Not Equal To - property not equal to the given value.
*/ */
public static Expression ne(String propertyName, Object value) { public static Expression ne(String propertyName, Object value) {
return DB.getExpressionFactory().ne(propertyName, value); return DB.expressionFactory().ne(propertyName, value);
} }
/** /**
@@ -49,7 +49,7 @@ public class Expr {
* using a lower() function to make it case insensitive). * using a lower() function to make it case insensitive).
*/ */
public static Expression ieq(String propertyName, String value) { public static Expression ieq(String propertyName, String value) {
return DB.getExpressionFactory().ieq(propertyName, value); return DB.expressionFactory().ieq(propertyName, value);
} }
/** /**
@@ -59,28 +59,28 @@ public class Expr {
* </p> * </p>
*/ */
public static Expression inRange(String propertyName, Object value1, Object value2) { public static Expression inRange(String propertyName, Object value1, Object value2) {
return DB.getExpressionFactory().inRange(propertyName, value1, value2); return DB.expressionFactory().inRange(propertyName, value1, value2);
} }
/** /**
* Between - property between the two given values. * Between - property between the two given values.
*/ */
public static Expression between(String propertyName, Object value1, Object value2) { public static Expression between(String propertyName, Object value1, Object value2) {
return DB.getExpressionFactory().between(propertyName, value1, value2); return DB.expressionFactory().between(propertyName, value1, value2);
} }
/** /**
* Between - value between two given properties. * Between - value between two given properties.
*/ */
public static Expression between(String lowProperty, String highProperty, Object value) { public static Expression between(String lowProperty, String highProperty, Object value) {
return DB.getExpressionFactory().betweenProperties(lowProperty, highProperty, value); return DB.expressionFactory().betweenProperties(lowProperty, highProperty, value);
} }
/** /**
* Greater Than - property greater than the given value. * Greater Than - property greater than the given value.
*/ */
public static Expression gt(String propertyName, Object value) { public static Expression gt(String propertyName, Object value) {
return DB.getExpressionFactory().gt(propertyName, value); return DB.expressionFactory().gt(propertyName, value);
} }
/** /**
@@ -88,42 +88,42 @@ public class Expr {
* value. * value.
*/ */
public static Expression ge(String propertyName, Object value) { public static Expression ge(String propertyName, Object value) {
return DB.getExpressionFactory().ge(propertyName, value); return DB.expressionFactory().ge(propertyName, value);
} }
/** /**
* Less Than - property less than the given value. * Less Than - property less than the given value.
*/ */
public static Expression lt(String propertyName, Object value) { public static Expression lt(String propertyName, Object value) {
return DB.getExpressionFactory().lt(propertyName, value); return DB.expressionFactory().lt(propertyName, value);
} }
/** /**
* Less Than or Equal to - property less than or equal to the given value. * Less Than or Equal to - property less than or equal to the given value.
*/ */
public static Expression le(String propertyName, Object value) { public static Expression le(String propertyName, Object value) {
return DB.getExpressionFactory().le(propertyName, value); return DB.expressionFactory().le(propertyName, value);
} }
/** /**
* Is Null - property is null. * Is Null - property is null.
*/ */
public static Expression isNull(String propertyName) { public static Expression isNull(String propertyName) {
return DB.getExpressionFactory().isNull(propertyName); return DB.expressionFactory().isNull(propertyName);
} }
/** /**
* Is Not Null - property is not null. * Is Not Null - property is not null.
*/ */
public static Expression isNotNull(String propertyName) { public static Expression isNotNull(String propertyName) {
return DB.getExpressionFactory().isNotNull(propertyName); return DB.expressionFactory().isNotNull(propertyName);
} }
/** /**
* Case insensitive {@link #exampleLike(Object)} * Case insensitive {@link #exampleLike(Object)}
*/ */
public static ExampleExpression iexampleLike(Object example) { public static ExampleExpression iexampleLike(Object example) {
return DB.getExpressionFactory().iexampleLike(example); return DB.expressionFactory().iexampleLike(example);
} }
/** /**
@@ -131,14 +131,14 @@ public class Expr {
* LikeType.RAW (you need to add you own wildcards % and _). * LikeType.RAW (you need to add you own wildcards % and _).
*/ */
public static ExampleExpression exampleLike(Object example) { public static ExampleExpression exampleLike(Object example) {
return DB.getExpressionFactory().exampleLike(example); return DB.expressionFactory().exampleLike(example);
} }
/** /**
* Create the query by Example expression specifying more options. * Create the query by Example expression specifying more options.
*/ */
public static ExampleExpression exampleLike(Object example, boolean caseInsensitive, LikeType likeType) { public static ExampleExpression exampleLike(Object example, boolean caseInsensitive, LikeType likeType) {
return DB.getExpressionFactory().exampleLike(example, caseInsensitive, likeType); return DB.expressionFactory().exampleLike(example, caseInsensitive, likeType);
} }
/** /**
@@ -146,7 +146,7 @@ public class Expr {
* characters % (percentage) and _ (underscore). * characters % (percentage) and _ (underscore).
*/ */
public static Expression like(String propertyName, String value) { public static Expression like(String propertyName, String value) {
return DB.getExpressionFactory().like(propertyName, value); return DB.expressionFactory().like(propertyName, value);
} }
/** /**
@@ -155,14 +155,14 @@ public class Expr {
* a lower() function to make the expression case insensitive. * a lower() function to make the expression case insensitive.
*/ */
public static Expression ilike(String propertyName, String value) { public static Expression ilike(String propertyName, String value) {
return DB.getExpressionFactory().ilike(propertyName, value); return DB.expressionFactory().ilike(propertyName, value);
} }
/** /**
* Starts With - property like value%. * Starts With - property like value%.
*/ */
public static Expression startsWith(String propertyName, String value) { public static Expression startsWith(String propertyName, String value) {
return DB.getExpressionFactory().startsWith(propertyName, value); return DB.expressionFactory().startsWith(propertyName, value);
} }
/** /**
@@ -170,14 +170,14 @@ public class Expr {
* lower() function to make the expression case insensitive. * lower() function to make the expression case insensitive.
*/ */
public static Expression istartsWith(String propertyName, String value) { public static Expression istartsWith(String propertyName, String value) {
return DB.getExpressionFactory().istartsWith(propertyName, value); return DB.expressionFactory().istartsWith(propertyName, value);
} }
/** /**
* Ends With - property like %value. * Ends With - property like %value.
*/ */
public static Expression endsWith(String propertyName, String value) { public static Expression endsWith(String propertyName, String value) {
return DB.getExpressionFactory().endsWith(propertyName, value); return DB.expressionFactory().endsWith(propertyName, value);
} }
/** /**
@@ -185,14 +185,14 @@ public class Expr {
* function to make the expression case insensitive. * function to make the expression case insensitive.
*/ */
public static Expression iendsWith(String propertyName, String value) { public static Expression iendsWith(String propertyName, String value) {
return DB.getExpressionFactory().iendsWith(propertyName, value); return DB.expressionFactory().iendsWith(propertyName, value);
} }
/** /**
* Contains - property like %value%. * Contains - property like %value%.
*/ */
public static Expression contains(String propertyName, String value) { public static Expression contains(String propertyName, String value) {
return DB.getExpressionFactory().contains(propertyName, value); return DB.expressionFactory().contains(propertyName, value);
} }
/** /**
@@ -200,42 +200,42 @@ public class Expr {
* function to make the expression case insensitive. * function to make the expression case insensitive.
*/ */
public static Expression icontains(String propertyName, String value) { public static Expression icontains(String propertyName, String value) {
return DB.getExpressionFactory().icontains(propertyName, value); return DB.expressionFactory().icontains(propertyName, value);
} }
/** /**
* For collection properties that are empty (have not existing elements). * For collection properties that are empty (have not existing elements).
*/ */
public static Expression isEmpty(String propertyName) { public static Expression isEmpty(String propertyName) {
return DB.getExpressionFactory().isEmpty(propertyName); return DB.expressionFactory().isEmpty(propertyName);
} }
/** /**
* For collection properties that are not empty (have existing elements). * For collection properties that are not empty (have existing elements).
*/ */
public static Expression isNotEmpty(String propertyName) { public static Expression isNotEmpty(String propertyName) {
return DB.getExpressionFactory().isNotEmpty(propertyName); return DB.expressionFactory().isNotEmpty(propertyName);
} }
/** /**
* In - property has a value in the array of values. * In - property has a value in the array of values.
*/ */
public static Expression in(String propertyName, Object[] values) { public static Expression in(String propertyName, Object[] values) {
return DB.getExpressionFactory().in(propertyName, values); return DB.expressionFactory().in(propertyName, values);
} }
/** /**
* In - using a subQuery. * In - using a subQuery.
*/ */
public static Expression in(String propertyName, Query<?> subQuery) { public static Expression in(String propertyName, Query<?> subQuery) {
return DB.getExpressionFactory().in(propertyName, subQuery); return DB.expressionFactory().in(propertyName, subQuery);
} }
/** /**
* In - property has a value in the collection of values. * In - property has a value in the collection of values.
*/ */
public static Expression in(String propertyName, Collection<?> values) { public static Expression in(String propertyName, Collection<?> values) {
return DB.getExpressionFactory().in(propertyName, values); return DB.expressionFactory().in(propertyName, values);
} }
/** /**
@@ -272,14 +272,14 @@ public class Expr {
* }</pre> * }</pre>
*/ */
public static Expression inOrEmpty(String propertyName, Collection<?> values) { public static Expression inOrEmpty(String propertyName, Collection<?> values) {
return DB.getExpressionFactory().inOrEmpty(propertyName, values); return DB.expressionFactory().inOrEmpty(propertyName, values);
} }
/** /**
* Id Equal to - ID property is equal to the value. * Id Equal to - ID property is equal to the value.
*/ */
public static Expression idEq(Object value) { public static Expression idEq(Object value) {
return DB.getExpressionFactory().idEq(value); return DB.expressionFactory().idEq(value);
} }
/** /**
@@ -292,7 +292,7 @@ public class Expr {
* @param propertyMap a map keyed by property names. * @param propertyMap a map keyed by property names.
*/ */
public static Expression allEq(Map<String, Object> propertyMap) { public static Expression allEq(Map<String, Object> propertyMap) {
return DB.getExpressionFactory().allEq(propertyMap); return DB.expressionFactory().allEq(propertyMap);
} }
/** /**
@@ -303,7 +303,7 @@ public class Expr {
* </p> * </p>
*/ */
public static Expression raw(String raw, Object value) { public static Expression raw(String raw, Object value) {
return DB.getExpressionFactory().raw(raw, value); return DB.expressionFactory().raw(raw, value);
} }
/** /**
@@ -314,53 +314,48 @@ public class Expr {
* </p> * </p>
*/ */
public static Expression raw(String raw, Object[] values) { public static Expression raw(String raw, Object[] values) {
return DB.getExpressionFactory().raw(raw, values); return DB.expressionFactory().raw(raw, values);
} }
/** /**
* Add raw expression with no parameters. * Add raw expression with no parameters.
*/ */
public static Expression raw(String raw) { public static Expression raw(String raw) {
return DB.getExpressionFactory().raw(raw); return DB.expressionFactory().raw(raw);
} }
/** /**
* And - join two expressions with a logical and. * And - join two expressions with a logical and.
*/ */
public static Expression and(Expression expOne, Expression expTwo) { public static Expression and(Expression expOne, Expression expTwo) {
return DB.expressionFactory().and(expOne, expTwo);
return DB.getExpressionFactory().and(expOne, expTwo);
} }
/** /**
* Or - join two expressions with a logical or. * Or - join two expressions with a logical or.
*/ */
public static Expression or(Expression expOne, Expression expTwo) { public static Expression or(Expression expOne, Expression expTwo) {
return DB.expressionFactory().or(expOne, expTwo);
return DB.getExpressionFactory().or(expOne, expTwo);
} }
/** /**
* Negate the expression (prefix it with NOT). * Negate the expression (prefix it with NOT).
*/ */
public static Expression not(Expression exp) { public static Expression not(Expression exp) {
return DB.expressionFactory().not(exp);
return DB.getExpressionFactory().not(exp);
} }
/** /**
* Return a list of expressions that will be joined by AND's. * Return a list of expressions that will be joined by AND's.
*/ */
public static <T> Junction<T> conjunction(Query<T> query) { public static <T> Junction<T> conjunction(Query<T> query) {
return DB.expressionFactory().conjunction(query);
return DB.getExpressionFactory().conjunction(query);
} }
/** /**
* Return a list of expressions that will be joined by OR's. * Return a list of expressions that will be joined by OR's.
*/ */
public static <T> Junction<T> disjunction(Query<T> query) { public static <T> Junction<T> disjunction(Query<T> query) {
return DB.expressionFactory().disjunction(query);
return DB.getExpressionFactory().disjunction(query);
} }
} }