Changeset 7489
- Timestamp:
- May 28, 2018, 11:13:22 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3.12-stable/src/core/net/sf/basedb/core/AnnotationSimpleRestriction.java
r7456 r7489 113 113 114 114 /** 115 Creates a new annotation restriction for a specific <code>valueType</code>. 116 The restriction is with a list of values. 117 118 @param alias The alias of a joined item where the annotations are 119 located or null to use the root entity of the query 120 @param annotationType The annotation type to use in the query 121 @param operator The operator, it must be one of the expression 122 operators, EQ, NEQ, etc., not a boolean operator, AND, OR, etc. 123 @param values The list of values that should be used in the query, they must be of the 124 correct value type for the annotation as defined by the 125 {@link AnnotationType#getValueType()} property. 126 @param options Options that specify which annotations to consider when searching 127 @throws InvalidDataException If any of the parameters are null 128 or not follow the rules above 129 @since 3.12.3 130 */ 131 public AnnotationSimpleRestriction(String alias, AnnotationType annotationType, Operator operator, List<Object> values, 132 Options options) 133 throws InvalidDataException 134 { 135 super(alias, annotationType, options); 136 if (operator == null) throw new InvalidUseOfNullException("operator"); 137 if (values == null) throw new InvalidUseOfNullException("values"); 138 if (!operator.isExpressionOperator()) 139 { 140 throw new InvalidDataException("Invalid operator for expression: "+operator); 141 } 142 for (Object obj : values) 143 { 144 if (obj != null && !valueType.isCorrectType(obj) && !(valueType.isNumerical() && obj instanceof Number)) 145 { 146 throw new InvalidDataException("Value '"+obj+"' is a "+ 147 obj.getClass()+", not a "+valueType); 148 } 149 } 150 this.operator = operator; 151 this.value = null; 152 this.values = values; 153 } 154 155 156 /** 115 157 @since 2.4 116 158 @deprecated in 3.5; Use {@link #AnnotationSimpleRestriction(String, int, Type, Operator, Object, boolean, boolean)} instead … … 163 205 /** 164 206 @since 3.5 165 @deprecated In 3.11, use {@link #AnnotationSimpleRestriction(String, AnnotationType, Operator, Object, AnnotationRestriction.Options)} instead207 @deprecated In 3.11, use {@link #AnnotationSimpleRestriction(String, AnnotationType, Operator, List, AnnotationRestriction.Options)} instead 166 208 */ 167 209 @Deprecated
Note: See TracChangeset
for help on using the changeset viewer.