Convert single values into Collections in order to support varargs "IN" expressions.

git-svn-id: https://svn.apache.org/repos/asf/incubator/openjpa/trunk@487925 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Marc Prud'hommeaux 2006-12-17 00:59:59 +00:00
parent d98ca1d91d
commit 25988d2793
1 changed files with 3 additions and 1 deletions

View File

@ -16,6 +16,7 @@
package org.apache.openjpa.kernel.exps;
import java.util.Collection;
import java.util.Collections;
import org.apache.openjpa.kernel.StoreContext;
@ -68,7 +69,8 @@ class ContainsExpression
* Return the container collection for the given value.
*/
protected Collection getCollection(Object obj) {
return (Collection) obj;
return obj instanceof Collection ?
(Collection) obj : Collections.singleton(obj);
}
public void acceptVisit(ExpressionVisitor visitor) {