|
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 net.sf.basedb.core.AnnotationSimpleRestriction
public class AnnotationSimpleRestriction
Restricts a query using annotation values with a simple expression:
annotation operator value
.
Annotations
Field Summary | |
---|---|
private Operator |
operator
|
private List<ParameterExpression> |
parameters
|
private Object |
value
|
private List<Object> |
values
|
Fields inherited from class net.sf.basedb.core.AnnotationRestriction |
---|
alias, annotationTypeId, includeInheriting, valueType |
Constructor Summary | |
---|---|
AnnotationSimpleRestriction(AnnotationType annotationType,
Operator operator,
Object value,
boolean includeInheriting)
Deprecated. Use AnnotationSimpleRestriction(String, AnnotationType, Operator, Object, boolean)
instead with alias=null |
|
AnnotationSimpleRestriction(int annotationTypeId,
Type valueType,
Operator operator,
Object value,
boolean includeInheriting)
Deprecated. Use AnnotationSimpleRestriction(String, int, Type, Operator, Object, boolean)
instead with alias=null |
|
AnnotationSimpleRestriction(String alias,
AnnotationType annotationType,
Operator operator,
Object value,
boolean includeInheriting)
Create a new annotation restriction using a simple expression: annotation operator value . |
|
AnnotationSimpleRestriction(String alias,
int annotationTypeId,
Type valueType,
Operator operator,
List<Object> values,
boolean includeInheriting)
Creates a new annotation restriction for a specific valueType . |
|
AnnotationSimpleRestriction(String alias,
int annotationTypeId,
Type valueType,
Operator operator,
Object value,
boolean includeInheriting)
Creates a new annotation restriction for a specific valueType . |
Method Summary | |
---|---|
boolean |
equals(Object other)
This restriction is equal to another AnnotationSimpleRestriction if they have the same annotation type, operator, list of values and inheritance setting. |
(package private) String |
getRestrictionSql(Query query,
DbControl dc)
Get an SQL fragment that includes the actual restriction. |
int |
hashCode()
|
(package private) void |
setRestrictionParameters(org.hibernate.SQLQuery query)
Set the value for all parameters defined in the SQL fragment returned by AnnotationRestriction.getRestrictionSql(Query, DbControl) . |
Methods inherited from class net.sf.basedb.core.AnnotationRestriction |
---|
getChildren, maybeEquals, notAmongSelected, toQl |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private final Operator operator
private final Object value
private final List<Object> values
private List<ParameterExpression> parameters
Constructor Detail |
---|
public AnnotationSimpleRestriction(AnnotationType annotationType, Operator operator, Object value, boolean includeInheriting) throws InvalidDataException
AnnotationSimpleRestriction(String, AnnotationType, Operator, Object, boolean)
instead with alias=null
annotation operator value
. The restriction is applied to
the root element of the query.
InvalidDataException
public AnnotationSimpleRestriction(String alias, AnnotationType annotationType, Operator operator, Object value, boolean includeInheriting) throws InvalidDataException
annotation operator value
.
alias
- The alias of a joined item where the annotations are
located or null to use the root entity of the queryannotationType
- The annotation type to use in the queryoperator
- The operator, it must be one of the expression
operators, EQ, NEQ, etc., not a boolean operator, AND, OR, etc.value
- The value to use in the query, it must be of the
correct value type for the annotation as defined by the
AnnotationType.getValueType()
propertyincludeInheriting
- If items inherting the annotation should be returned
by the query or not
InvalidDataException
- If any of the parameters are null
or not follow the rules above.public AnnotationSimpleRestriction(int annotationTypeId, Type valueType, Operator operator, Object value, boolean includeInheriting) throws InvalidDataException
AnnotationSimpleRestriction(String, int, Type, Operator, Object, boolean)
instead with alias=null
valueType
.
The restriction is applied to the root element of the query.
InvalidDataException
public AnnotationSimpleRestriction(String alias, int annotationTypeId, Type valueType, Operator operator, Object value, boolean includeInheriting) throws InvalidDataException
valueType
.
alias
- The alias of a joined item where the annotations are
located or null to use the root entity of the queryannotationTypeId
- the id of the annotation type to use in the queryvalueType
- the type of values for annotationsoperator
- The operator, it must be one of the expression
operators, EQ, NEQ, etc., not a boolean operator, AND, OR, etc.value
- The value to use in the query, it must be of the
correct value type for the annotation as defined by the
AnnotationType.getValueType()
propertyincludeInheriting
- TRUE if items inheriting the annotation should be returned by the query, FALSE otherwise
InvalidDataException
- If any of the parameters are null
or not follow the rules abovepublic AnnotationSimpleRestriction(String alias, int annotationTypeId, Type valueType, Operator operator, List<Object> values, boolean includeInheriting) throws InvalidDataException
valueType
.
The restriction is with a list of values.
alias
- The alias of a joined item where the annotations are
located or null to use the root entity of the queryannotationTypeId
- the id of the annotation type to use in the queryvalueType
- the type of values for annotationsoperator
- The operator, it must be one of the expression
operators, EQ, NEQ, etc., not a boolean operator, AND, OR, etc.values
- The list of values that should be used in the query, they must be of the
correct value type for the annotation as defined by the
AnnotationType.getValueType()
property.includeInheriting
- TRUE if items inheriting the annotation should be returned by the query, FALSE otherwise
InvalidDataException
- If any of the parameters are null
or not follow the rules aboveMethod Detail |
---|
String getRestrictionSql(Query query, DbControl dc) throws BaseException
AnnotationRestriction
v.value = :theValue ThesetRestrictionParameters
method is called to allow the subclass to set the value of the parameters specified in the SQL fragment.
getRestrictionSql
in class AnnotationRestriction
query
- The query object we are about to execute
BaseException
AnnotationRestriction.setRestrictionParameters(SQLQuery)
void setRestrictionParameters(org.hibernate.SQLQuery query)
AnnotationRestriction
AnnotationRestriction.getRestrictionSql(Query, DbControl)
.
setRestrictionParameters
in class AnnotationRestriction
query
- The Hibernate SQLQuery
object which is
used to query the databasepublic boolean equals(Object other)
equals
in class Object
public int hashCode()
hashCode
in class AnnotationRestriction
|
2.17.2: 2011-06-17 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |