public class AnnotationSimpleRestriction extends AnnotationRestriction
annotation operator value
.Annotations
Modifier and Type | Field and Description |
---|---|
private Operator |
operator |
private List<ParameterExpression> |
parameters |
private Object |
value |
private List<Object> |
values |
alias, annotationTypeId, includeInheriting, valueType
Constructor and Description |
---|
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 . |
Modifier and Type | Method and Description |
---|---|
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(SQLQuery query)
Set the value for all parameters defined in the SQL fragment
returned by
AnnotationRestriction.getRestrictionSql(Query, DbControl) . |
getChildren, maybeEquals, notAmongSelected, toQl
private final Operator operator
private final Object value
private List<ParameterExpression> parameters
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 notInvalidDataException
- If any of the parameters are null
or not follow the rules above.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 otherwiseInvalidDataException
- 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 otherwiseInvalidDataException
- If any of the parameters are null
or not follow the rules aboveString getRestrictionSql(Query query, DbControl dc) throws BaseException
AnnotationRestriction
v.value = :theValue
The setRestrictionParameters
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 executeBaseException
AnnotationRestriction.setRestrictionParameters(SQLQuery)
void setRestrictionParameters(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)
public int hashCode()
hashCode
in class AnnotationRestriction