mirror of
https://github.com/ebean-orm/ebean.git
synced 2026-11-23 15:12:58 +00:00
#417 - ENH: Add JSON expressions ... path exists and value at path equals value
This commit is contained in:
1 parent
054f7dc86f
commit
5726410f6f
18 files changed
+584
-33
No files matched your search
@@ -363,6 +363,78 @@ public class DefaultExpressionList<T> implements SpiExpressionList<T> {
|
||||
return hash;
|
||||
}
|
||||
|
||||
/**
|
||||
* Path exists - for the given path in a JSON document.
|
||||
*/
|
||||
@Override
|
||||
public ExpressionList<T> jsonExists(String propertyName, String path) {
|
||||
add(expr.jsonExists(propertyName, path));
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Path does not exist - for the given path in a JSON document.
|
||||
*/
|
||||
@Override
|
||||
public ExpressionList<T> jsonNotExists(String propertyName, String path){
|
||||
add(expr.jsonNotExists(propertyName, path));
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Equal to expression for the value at the given path in the JSON document.
|
||||
*/
|
||||
@Override
|
||||
public ExpressionList<T> jsonEqualTo(String propertyName, String path, Object value){
|
||||
add(expr.jsonEqualTo(propertyName, path, value));
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Not Equal to - for the given path in a JSON document.
|
||||
*/
|
||||
@Override
|
||||
public ExpressionList<T> jsonNotEqualTo(String propertyName, String path, Object val){
|
||||
add(expr.jsonNotEqualTo(propertyName, path, val));
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Greater than - for the given path in a JSON document.
|
||||
*/
|
||||
@Override
|
||||
public ExpressionList<T> jsonGreaterThan(String propertyName, String path, Object val){
|
||||
add(expr.jsonGreaterThan(propertyName, path, val));
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Greater than or equal to - for the given path in a JSON document.
|
||||
*/
|
||||
@Override
|
||||
public ExpressionList<T> jsonGreaterOrEqual(String propertyName, String path, Object val){
|
||||
add(expr.jsonGreaterOrEqual(propertyName, path, val));
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Less than - for the given path in a JSON document.
|
||||
*/
|
||||
@Override
|
||||
public ExpressionList<T> jsonLessThan(String propertyName, String path, Object val){
|
||||
add(expr.jsonLessThan(propertyName, path, val));
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Less than or equal to - for the given path in a JSON document.
|
||||
*/
|
||||
@Override
|
||||
public ExpressionList<T> jsonLessOrEqualTo(String propertyName, String path, Object val){
|
||||
add(expr.jsonLessOrEqualTo(propertyName, path, val));
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ExpressionList<T> eq(String propertyName, Object value) {
|
||||
add(expr.eq(propertyName, value));
|
||||
|
||||
@@ -3,9 +3,11 @@ package com.avaje.ebeaninternal.util;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import com.avaje.ebeaninternal.api.SpiExpressionRequest;
|
||||
import com.avaje.ebeaninternal.server.core.JsonExpressionHandler;
|
||||
import com.avaje.ebeaninternal.server.core.SpiOrmQueryRequest;
|
||||
import com.avaje.ebeaninternal.server.deploy.BeanDescriptor;
|
||||
import com.avaje.ebeaninternal.server.deploy.DeployParser;
|
||||
import com.avaje.ebeaninternal.server.persist.Binder;
|
||||
|
||||
public class DefaultExpressionRequest implements SpiExpressionRequest {
|
||||
|
||||
@@ -19,18 +21,26 @@ public class DefaultExpressionRequest implements SpiExpressionRequest {
|
||||
|
||||
private final DeployParser deployParser;
|
||||
|
||||
private final Binder binder;
|
||||
|
||||
private int paramIndex;
|
||||
|
||||
public DefaultExpressionRequest(SpiOrmQueryRequest<?> queryRequest, DeployParser deployParser) {
|
||||
public DefaultExpressionRequest(SpiOrmQueryRequest<?> queryRequest, DeployParser deployParser, Binder binder) {
|
||||
this.queryRequest = queryRequest;
|
||||
this.beanDescriptor = queryRequest.getBeanDescriptor();
|
||||
this.deployParser = deployParser;
|
||||
this.binder = binder;
|
||||
}
|
||||
|
||||
public DefaultExpressionRequest(BeanDescriptor<?> beanDescriptor) {
|
||||
this.beanDescriptor = beanDescriptor;
|
||||
this.queryRequest = null;
|
||||
this.deployParser = null;
|
||||
this.binder = null;
|
||||
}
|
||||
|
||||
public JsonExpressionHandler getJsonHander() {
|
||||
return binder.getJsonExpressionHandler();
|
||||
}
|
||||
|
||||
public String parseDeploy(String logicalProp) {
|
||||
|
||||
Reference in new issue
Block a user