Package net.sf.basedb.core
Class AnnotationInRestriction
java.lang.Object
net.sf.basedb.core.AnnotationRestriction
net.sf.basedb.core.AnnotationInRestriction
- All Implemented Interfaces:
QueryElement
,Restriction
Restricts a query using annotation values that exists in a set
of given values.
- Version:
- 2.0
- Author:
- Nicklas
- See Also:
- Last modified
- $Date: 2019-03-12 08:29:06 +0100 (tis, 12 mars 2019) $
-
Nested Class Summary
Nested classes/interfaces inherited from class net.sf.basedb.core.AnnotationRestriction
AnnotationRestriction.Options
-
Field Summary
Fields inherited from class net.sf.basedb.core.AnnotationRestriction
alias, annotationTypeId, options, valueType
-
Constructor Summary
ConstructorDescriptionAnnotationInRestriction
(String alias, AnnotationType annotationType, boolean includePrimary, boolean includeInherited, Object... values) Deprecated.AnnotationInRestriction
(String alias, AnnotationType annotationType, AnnotationRestriction.Options options, Object... values) Create a new annotation restriction. -
Method Summary
Modifier and TypeMethodDescriptionboolean
This restriction is equal to another AnnotationInRestriction if they have the same annotation type, 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
(NativeQuery<?> query) Set the value for all parameters defined in the SQL fragment returned byAnnotationRestriction.getRestrictionSql(Query, DbControl)
.Methods inherited from class net.sf.basedb.core.AnnotationRestriction
getChildren, maybeEquals, notAmongSelected, toQl
-
Field Details
-
values
-
-
Constructor Details
-
AnnotationInRestriction
@Deprecated public AnnotationInRestriction(String alias, AnnotationType annotationType, boolean includePrimary, boolean includeInherited, Object... values) throws InvalidDataException Deprecated.- Throws:
InvalidDataException
- Since:
- 3.5
-
AnnotationInRestriction
public AnnotationInRestriction(String alias, AnnotationType annotationType, AnnotationRestriction.Options options, Object... values) throws InvalidDataException Create a new annotation restriction. At least one of includePrimary and includeInheriting must be true.- Parameters:
alias
- The alias to use in the restriction.annotationType
- The annotation type to use in the queryoptions
- Options that specify which annotations to consider when searchingvalues
- An array of values, each value must be of the correct value type for the annotation as defined by theAnnotationType.getValueType()
property- Throws:
InvalidDataException
- If any of the parameters are null or the array is empty or not follow the rules above.- Since:
- 3.11
-
-
Method Details
-
getRestrictionSql
Description copied from class:AnnotationRestriction
Get an SQL fragment that includes the actual restriction. Use 'v.value' to access the annotation value. Avoid including literal values originating from a user, especially strings, since it may lead to security holes unless the values are checked for dangerous characters. Use a parameter placeholder instead. A parameter placeholder is a colon (:) followed by a name. Example:v.value = :theValue
ThesetRestrictionParameters
method is called to allow the subclass to set the value of the parameters specified in the SQL fragment.- Specified by:
getRestrictionSql
in classAnnotationRestriction
- Parameters:
query
- The query object we are about to execute- Returns:
- An SQL fragment, or null if no additional restriction is required
- Throws:
BaseException
- See Also:
-
setRestrictionParameters
Description copied from class:AnnotationRestriction
Set the value for all parameters defined in the SQL fragment returned byAnnotationRestriction.getRestrictionSql(Query, DbControl)
.- Specified by:
setRestrictionParameters
in classAnnotationRestriction
- Parameters:
query
- The HibernateSQLQuery
object which is used to query the database
-
equals
This restriction is equal to another AnnotationInRestriction if they have the same annotation type, list of values and inheritance setting. -
hashCode
public int hashCode()- Overrides:
hashCode
in classAnnotationRestriction
-
AnnotationInRestriction(String, AnnotationType, AnnotationRestriction.Options, Object...)
instead