public class DefaultExampleExpression extends Object implements SpiExpression, ExampleExpression
Pass in an example entity and for each non-null scalar properties an expression is added.
// create an example bean and set the properties
// with the query parameters you want
Customer example = new Customer();
example.setName("Rob%");
example.setNotes("%something%");
List<Customer> list = Ebean.find(Customer.class).where()
// pass the bean into the where() clause
.exampleLike(example)
// you can add other expressions to the same query
.gt("id", 2).findList();
| Constructor and Description |
|---|
DefaultExampleExpression(Object entity,
boolean caseInsensitive,
LikeType likeType)
Construct the query by example expression.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addBindValues(SpiExpressionRequest request)
Adds bind values to the request.
|
void |
addSql(SpiExpressionRequest request)
Generates and adds the sql to the request.
|
ExampleExpression |
caseInsensitive()
Set case insensitive to true.
|
void |
containsMany(BeanDescriptor<?> desc,
ManyWhereJoins whereManyJoins)
Process "Many" properties populating ManyWhereJoins.
|
String |
getPropertyName()
This will return null for this example expression.
|
ExampleExpression |
includeZeros()
By calling this method zero value properties are going to be included in
the expression.
|
void |
queryAutoFetchHash(HashQueryPlanBuilder builder)
Return a hash for autoFetch query identification.
|
int |
queryBindHash()
Return a hash for the actual bind values used.
|
void |
queryPlanHash(BeanQueryRequest<?> request,
HashQueryPlanBuilder builder)
Return a hash for query plan identification.
|
ExampleExpression |
useContains()
Use contains expression for string properties.
|
ExampleExpression |
useEndsWith()
Use endsWith expression for string properties.
|
ExampleExpression |
useEqualTo()
Use equal to expression for string properties.
|
ExampleExpression |
useStartsWith()
Use startsWith expression for string properties.
|
public DefaultExampleExpression(Object entity, boolean caseInsensitive, LikeType likeType)
entity - the example entity with non null property valuescaseInsensitive - if true use case insensitive expressionslikeType - the type of Like wild card usedpublic void containsMany(BeanDescriptor<?> desc, ManyWhereJoins whereManyJoins)
SpiExpressionPredicates on Many properties require an extra independent join clause.
containsMany in interface SpiExpressionpublic ExampleExpression includeZeros()
ExampleExpressionBy default numeric zero values are excluded as they can result from primitive int and long types.
includeZeros in interface ExampleExpressionpublic ExampleExpression caseInsensitive()
ExampleExpressioncaseInsensitive in interface ExampleExpressionpublic ExampleExpression useStartsWith()
ExampleExpressionuseStartsWith in interface ExampleExpressionpublic ExampleExpression useContains()
ExampleExpressionuseContains in interface ExampleExpressionpublic ExampleExpression useEndsWith()
ExampleExpressionuseEndsWith in interface ExampleExpressionpublic ExampleExpression useEqualTo()
ExampleExpressionuseEqualTo in interface ExampleExpressionpublic String getPropertyName()
public void addBindValues(SpiExpressionRequest request)
addBindValues in interface SpiExpressionrequest - the associated request.public void addSql(SpiExpressionRequest request)
addSql in interface SpiExpressionrequest - the associated request.public void queryAutoFetchHash(HashQueryPlanBuilder builder)
queryAutoFetchHash in interface SpiExpressionpublic void queryPlanHash(BeanQueryRequest<?> request, HashQueryPlanBuilder builder)
queryPlanHash in interface SpiExpressionpublic int queryBindHash()
queryBindHash in interface SpiExpressionCopyright © 2014. All Rights Reserved.