|
2.17.2: 2011-06-17 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.basedb.core.AnnotationRestriction
abstract class AnnotationRestriction
Base class for creating restrictions based on annotations.
Subclasses must implent the getRestrictionSql(Query, DbControl)
and setRestrictionParameters(SQLQuery)
method.
Annotations
Field Summary | |
---|---|
(package private) String |
alias
|
(package private) int |
annotationTypeId
|
private static boolean |
debugSqlEnabled
So we don't always have to call logSql.debug() |
(package private) boolean |
includeInheriting
|
private static Logger |
logSql
Log all SQL statements. |
(package private) Type |
valueType
|
Constructor Summary | |
---|---|
AnnotationRestriction(String alias,
AnnotationType annotationType,
boolean includeInheriting)
Create a new annotation restriction for an annotation type. |
|
AnnotationRestriction(String alias,
int annotationTypeId,
Type valueType,
boolean includeInheriting)
Create a new annotation restriction given the id and value type of an annotation. |
Method Summary | |
---|---|
Collection<? extends QueryElement> |
getChildren()
Get the children of this query element or null if it has no children. |
(package private) abstract String |
getRestrictionSql(Query query,
DbControl dc)
Get an SQL fragment that includes the actual restriction. |
int |
hashCode()
|
protected Boolean |
maybeEquals(Object other)
Check as many things as possible to try to determine if the other object is equal to this object. |
(package private) boolean |
notAmongSelected()
If the main restriction should match items that had annotations among the selected annotation sets, or not. |
(package private) abstract void |
setRestrictionParameters(org.hibernate.SQLQuery query)
Set the value for all parameters defined in the SQL fragment returned by getRestrictionSql(Query, DbControl) . |
String |
toQl(Query query,
DbControl dc)
Create a query language string of the query element. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final Logger logSql
private static final boolean debugSqlEnabled
final Type valueType
final int annotationTypeId
final boolean includeInheriting
final String alias
Constructor Detail |
---|
AnnotationRestriction(String alias, AnnotationType annotationType, boolean includeInheriting) throws InvalidDataException
annotationType
- The annotation type to use in the query
InvalidDataException
AnnotationRestriction(String alias, int annotationTypeId, Type valueType, boolean includeInheriting) throws InvalidDataException
annotationTypeId
- The id of the annotation typevalueType
- The type of values for annotations
InvalidDataException
Method Detail |
---|
public String toQl(Query query, DbControl dc) throws BaseException
QueryElement
Query.getQueryType()
method to find out which query language is wanted
in case the element requires different syntax for different languages.
toQl
in interface QueryElement
query
- The query that is about to be executeddc
- The DbControl
object used to execute the query
BaseException
- If there is any other errorpublic Collection<? extends QueryElement> getChildren()
QueryElement
AddExpression
has two children, the expression
beeing added.
getChildren
in interface QueryElement
protected Boolean maybeEquals(Object other)
public int hashCode()
hashCode
in class Object
abstract String getRestrictionSql(Query query, DbControl dc) throws BaseException
v.value = :theValue ThesetRestrictionParameters
method is called to allow the subclass to set the value of the parameters specified in the SQL fragment.
query
- The query object we are about to execute
BaseException
setRestrictionParameters(SQLQuery)
abstract void setRestrictionParameters(org.hibernate.SQLQuery query)
getRestrictionSql(Query, DbControl)
.
query
- The Hibernate SQLQuery
object which is
used to query the databaseboolean notAmongSelected()
|
2.17.2: 2011-06-17 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |