T
- The target type of the query.public interface ObjectQuery<T> extends QueryCondition
ObjectQuery is the main inteface for build a "SELECT" query, it allow to add projection, condition, order and having clauses using instances of domain classes.
It is typesafe with compile time check, and produce refactor resistent query becouse are defined using the domani spacific classes.
ObjectQuery<Person> query = new GenericObjectQuery<Person>(Person.class);
Person toSearch = query.target();
query.prj(toSearch.getName());
query.eq(toSearch.getMum().getName(),"elisabeth");
query.gt(toSearch.getAge(),20);
query.order(toSearch.getName());
The main implementation is GenericObjecQuery but is not garantee that will be the same in future, we suggest to box the creation of ObjectQuery instances in a factory in your code.
Modifier and Type | Method and Description |
---|---|
Boolean |
box(boolean b)
Box a boolean.
|
Byte |
box(byte b)
Box a byte.
|
Character |
box(char c)
Box a char.
|
Double |
box(double d)
Box a double.
|
Float |
box(float f)
Box a float.
|
Integer |
box(int i)
Box an int.
|
Long |
box(long l)
Box an long.
|
Short |
box(short s)
Box an short.
|
HavingCondition |
having(Object projection,
ProjectionType type)
Declare an having condition on projection.
|
<J> J |
join(Class<J> joinClass)
Create a join object with the specified type
|
<J> J |
join(Class<J> joinClass,
JoinType type)
Create a join object with the specified type
|
<J> J |
join(J joinPath,
Class<J> joinClass)
Create a join object with the specified type, on the specified base path
|
<J> J |
join(J joinPath,
Class<J> joinClass,
JoinType type)
Create a join object with the specified type, on the specified base path
|
void |
order(Object order)
Add an order condition to query.
|
void |
order(Object order,
OrderType type)
Add an order to query.
|
void |
order(Object order,
ProjectionType projectionType,
OrderType type)
Add an order to query.
|
void |
prj(Object projection)
Add a projection to query.
|
void |
prj(Object projection,
ProjectionType type)
Add a projection to query with an operator.
|
<S> ObjectQuery<S> |
subQuery(Class<S> target)
Create a new Sub Query of current query.
|
T |
target()
Retrieve the instance to build query.
|
T target()
void prj(Object projection)
projection
- the projection object to add.void prj(Object projection, ProjectionType type)
projection
- the projection object to add.type
- the type of projection to add.void order(Object order)
order
- the order to add.void order(Object order, OrderType type)
order
- the order to add.type
- the type of order.void order(Object order, ProjectionType projectionType, OrderType type)
order
- the order to add.projectionType
- the tipe of projection for grouping actions in order.type
- the type of order.Byte box(byte b)
b
- to box.Character box(char c)
c
- to box.Boolean box(boolean b)
b
- to boxShort box(short s)
s
- to box.Integer box(int i)
i
- to box.Long box(long l)
l
- to box.Float box(float f)
f
- to box.Double box(double d)
d
- to box.HavingCondition having(Object projection, ProjectionType type)
projection
- target of condition.type
- grouping operation<S> ObjectQuery<S> subQuery(Class<S> target)
target
- class target of sub query.<J> J join(Class<J> joinClass)
joinClass
- the type of the join object.<J> J join(Class<J> joinClass, JoinType type)
joinClass
- the type of the join object.<J> J join(J joinPath, Class<J> joinClass)
joinPath
- the path to reach the base object.joinClass
- the type of the join object.Copyright © 2013 Object Query. All Rights Reserved.