com.avaje.ebean
Interface ExpressionFactory


public interface ExpressionFactory

Expression factory for creating standard expressions.

Creates standard common expressions for using in a Query Where or Having clause.

You will often not use this class directly but instead just add expressions via the methods on ExpressionList such as ExpressionList.gt(String, Object).

The ExpressionList is returned from Query.where().

  // Example: fetch orders where status equals new or orderDate > lastWeek.
  
 Expression newOrLastWeek = 
   Expr.or(Expr.eq("status", Order.Status.NEW), 
           Expr.gt("orderDate", lastWeek));
 
 Query<Order> query = Ebean.createQuery(Order.class);
 query.where().add(newOrLastWeek);
 List<Order> list = query.findList();
 ...
 

See Also:
Query.where()

Method Summary
 Expression allEq(Map<String,Object> propertyMap)
          All Equal - Map containing property names and their values.
 Expression and(Expression expOne, Expression expTwo)
          And - join two expressions with a logical and.
 Expression between(String propertyName, Object value1, Object value2)
          Between - property between the two given values.
 Expression betweenProperties(String lowProperty, String highProperty, Object value)
          Between - value between two given properties.
 Junction conjunction()
          Return a list of expressions that will be joined by AND's.
 Expression contains(String propertyName, String value)
          Contains - property like %value%.
 ExpressionFactory createExpressionFactory(String path)
          Create another expression factory with a given sub path.
 Junction disjunction()
          Return a list of expressions that will be joined by OR's.
 Expression endsWith(String propertyName, String value)
          Ends With - property like %value.
 Expression eq(String propertyName, Object value)
          Equal To - property equal to the given value.
 ExampleExpression exampleLike(Object example)
          Create the query by Example expression which is case sensitive and using LikeType.RAW (you need to add you own wildcards % and _).
 ExampleExpression exampleLike(Object example, boolean caseInsensitive, LikeType likeType)
          Create the query by Example expression specifying more options.
 Expression ge(String propertyName, Object value)
          Greater Than or Equal to - property greater than or equal to the given value.
 String getLang()
          Return the language for this expression factory.
 Expression gt(String propertyName, Object value)
          Greater Than - property greater than the given value.
 Expression icontains(String propertyName, String value)
          Case insensitive Contains - property like %value%.
 Expression idEq(Object value)
          Id Equal to - ID property is equal to the value.
 Expression idIn(List<?> idList)
          Id IN a list of Id values.
 Expression iendsWith(String propertyName, String value)
          Case insensitive Ends With - property like %value.
 Expression ieq(String propertyName, String value)
          Case Insensitive Equal To - property equal to the given value (typically using a lower() function to make it case insensitive).
 ExampleExpression iexampleLike(Object example)
          Case insensitive exampleLike(Object)
 Expression ilike(String propertyName, String value)
          Case insensitive Like - property like value where the value contains the SQL wild card characters % (percentage) and _ (underscore).
 Expression in(String propertyName, Collection<?> values)
          In - property has a value in the collection of values.
 Expression in(String propertyName, Object[] values)
          In - property has a value in the array of values.
 Expression in(String propertyName, Query<?> subQuery)
          In - using a subQuery.
 Expression isNotNull(String propertyName)
          Is Not Null - property is not null.
 Expression isNull(String propertyName)
          Is Null - property is null.
 Expression istartsWith(String propertyName, String value)
          Case insensitive Starts With - property like value%.
 Expression le(String propertyName, Object value)
          Less Than or Equal to - property less than or equal to the given value.
 Expression like(String propertyName, String value)
          Like - property like value where the value contains the SQL wild card characters % (percentage) and _ (underscore).
 Expression lt(String propertyName, Object value)
          Less Than - property less than the given value.
 Expression ne(String propertyName, Object value)
          Not Equal To - property not equal to the given value.
 Expression not(Expression exp)
          Negate the expression (prefix it with NOT).
 Expression or(Expression expOne, Expression expTwo)
          Or - join two expressions with a logical or.
 Expression raw(String raw)
          Add raw expression with no parameters.
 Expression raw(String raw, Object value)
          Add raw expression with a single parameter.
 Expression raw(String raw, Object[] values)
          Add raw expression with an array of parameters.
 Expression startsWith(String propertyName, String value)
          Starts With - property like value%.
 

Method Detail

getLang

String getLang()
Return the language for this expression factory.


createExpressionFactory

ExpressionFactory createExpressionFactory(String path)
Create another expression factory with a given sub path.


eq

Expression eq(String propertyName,
              Object value)
Equal To - property equal to the given value.


ne

Expression ne(String propertyName,
              Object value)
Not Equal To - property not equal to the given value.


ieq

Expression ieq(String propertyName,
               String value)
Case Insensitive Equal To - property equal to the given value (typically using a lower() function to make it case insensitive).


between

Expression between(String propertyName,
                   Object value1,
                   Object value2)
Between - property between the two given values.


betweenProperties

Expression betweenProperties(String lowProperty,
                             String highProperty,
                             Object value)
Between - value between two given properties.


gt

Expression gt(String propertyName,
              Object value)
Greater Than - property greater than the given value.


ge

Expression ge(String propertyName,
              Object value)
Greater Than or Equal to - property greater than or equal to the given value.


lt

Expression lt(String propertyName,
              Object value)
Less Than - property less than the given value.


le

Expression le(String propertyName,
              Object value)
Less Than or Equal to - property less than or equal to the given value.


isNull

Expression isNull(String propertyName)
Is Null - property is null.


isNotNull

Expression isNotNull(String propertyName)
Is Not Null - property is not null.


iexampleLike

ExampleExpression iexampleLike(Object example)
Case insensitive exampleLike(Object)


exampleLike

ExampleExpression exampleLike(Object example)
Create the query by Example expression which is case sensitive and using LikeType.RAW (you need to add you own wildcards % and _).


exampleLike

ExampleExpression exampleLike(Object example,
                              boolean caseInsensitive,
                              LikeType likeType)
Create the query by Example expression specifying more options.


like

Expression like(String propertyName,
                String value)
Like - property like value where the value contains the SQL wild card characters % (percentage) and _ (underscore).


ilike

Expression ilike(String propertyName,
                 String value)
Case insensitive Like - property like value where the value contains the SQL wild card characters % (percentage) and _ (underscore). Typically uses a lower() function to make the expression case insensitive.


startsWith

Expression startsWith(String propertyName,
                      String value)
Starts With - property like value%.


istartsWith

Expression istartsWith(String propertyName,
                       String value)
Case insensitive Starts With - property like value%. Typically uses a lower() function to make the expression case insensitive.


endsWith

Expression endsWith(String propertyName,
                    String value)
Ends With - property like %value.


iendsWith

Expression iendsWith(String propertyName,
                     String value)
Case insensitive Ends With - property like %value. Typically uses a lower() function to make the expression case insensitive.


contains

Expression contains(String propertyName,
                    String value)
Contains - property like %value%.


icontains

Expression icontains(String propertyName,
                     String value)
Case insensitive Contains - property like %value%. Typically uses a lower() function to make the expression case insensitive.


in

Expression in(String propertyName,
              Object[] values)
In - property has a value in the array of values.


in

Expression in(String propertyName,
              Query<?> subQuery)
In - using a subQuery.


in

Expression in(String propertyName,
              Collection<?> values)
In - property has a value in the collection of values.


idEq

Expression idEq(Object value)
Id Equal to - ID property is equal to the value.


idIn

Expression idIn(List<?> idList)
Id IN a list of Id values.


allEq

Expression allEq(Map<String,Object> propertyMap)
All Equal - Map containing property names and their values.

Expression where all the property names in the map are equal to the corresponding value.

Parameters:
propertyMap - a map keyed by property names.

raw

Expression raw(String raw,
               Object value)
Add raw expression with a single parameter.

The raw expression should contain a single ? at the location of the parameter.


raw

Expression raw(String raw,
               Object[] values)
Add raw expression with an array of parameters.

The raw expression should contain the same number of ? as there are parameters.


raw

Expression raw(String raw)
Add raw expression with no parameters.


and

Expression and(Expression expOne,
               Expression expTwo)
And - join two expressions with a logical and.


or

Expression or(Expression expOne,
              Expression expTwo)
Or - join two expressions with a logical or.


not

Expression not(Expression exp)
Negate the expression (prefix it with NOT).


conjunction

Junction conjunction()
Return a list of expressions that will be joined by AND's.


disjunction

Junction disjunction()
Return a list of expressions that will be joined by OR's.



Copyright © 2010. All Rights Reserved.