Package net.sf.basedb.core.query
Class Annotations
java.lang.Object
net.sf.basedb.core.query.Annotations
A factory class to create restrictions based on annotation values.
- Version:
- 2.0
- Author:
- Nicklas
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic Expression
expression
(String alias, AnnotationType annotationType) Create an expression representing the value of an annotation to a joined item of the query.static Expression
expression
(AnnotationType annotationType) Create an expression representing the value of an annotation to the root item of the query.static Join
innerJoin
(String alias, AnnotationType annotationType, String joinedAlias) Create an inner join between an already joined element of a query and the annotation values for the given annotation type.static Join
innerJoin
(AnnotationType annotationType, String joinedAlias) Create an inner join between the root element of a query and the annotation values for the given annotation type.static Join
leftJoin
(String alias, AnnotationType annotationType, String joinedAlias) Create a left join between an already joined element of a query and the annotation values for the given annotation type.static Join
leftJoin
(AnnotationType annotationType, String joinedAlias) Create a left join between the root element of a query and the annotation values for the given annotation type.
-
Constructor Details
-
Annotations
public Annotations()
-
-
Method Details
-
expression
Create an expression representing the value of an annotation to the root item of the query. This method works best with single-valued annotation types. It can generate duplicate result rows for the same entity for multi-valued annotations.- Parameters:
annotationType
- The annotation type to generate an expression for- Returns:
- An expression
- Throws:
InvalidDataException
- If the annotationType is null- Since:
- 3.2
-
expression
Create an expression representing the value of an annotation to a joined item of the query. This method works best with single-valued annotation types. It can generate duplicate result rows for the same entity for multi-valued annotations.- Parameters:
alias
- The alias of a joined item or null to use the root itemannotationType
- The annotation type to generate an expression for- Returns:
- An expression
- Throws:
InvalidDataException
- If the annotationType is null- Since:
- 3.2
-
innerJoin
Create an inner join between the root element of a query and the annotation values for the given annotation type.- Parameters:
annotationType
- The annotation type to to joinjoinedAlias
- The alias to use for the joined annotation values- Returns:
- A join query element
- Throws:
InvalidDataException
- If the annotationType or joinedAlias is null- Since:
- 3.2
-
innerJoin
Create an inner join between an already joined element of a query and the annotation values for the given annotation type.- Parameters:
alias
- The alias of a joined item or null to use the root itemannotationType
- The annotation type to to joinjoinedAlias
- The alias to use for the joined annotation values- Returns:
- A join query element
- Throws:
InvalidDataException
- If the annotationType or joinedAlias is null- Since:
- 3.2
-
leftJoin
Create a left join between the root element of a query and the annotation values for the given annotation type.- Parameters:
annotationType
- The annotation type to to joinjoinedAlias
- The alias to use for the joined annotation values- Returns:
- A join query element
- Throws:
InvalidDataException
- If the annotationType or joinedAlias is null- Since:
- 3.3
-
leftJoin
Create a left join between an already joined element of a query and the annotation values for the given annotation type.- Parameters:
alias
- The alias of a joined item or null to use the root itemannotationType
- The annotation type to to joinjoinedAlias
- The alias to use for the joined annotation values- Returns:
- A join query element
- Throws:
InvalidDataException
- If the annotationType or joinedAlias is null- Since:
- 3.2
-