cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject svn commit: r1479625 - /cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/exp/Property.java
Date Mon, 06 May 2013 16:19:28 GMT
Author: aadamchik
Date: Mon May  6 16:19:27 2013
New Revision: 1479625

URL: http://svn.apache.org/r1479625
Log:
CAY-1814  Support Property.nin

Modified:
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/exp/Property.java

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/exp/Property.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/exp/Property.java?rev=1479625&r1=1479624&r2=1479625&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/exp/Property.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/exp/Property.java
Mon May  6 16:19:27 2013
@@ -118,7 +118,7 @@ public class Property<E> {
     public Expression likeInsensitive(E value) {
         return ExpressionFactory.likeIgnoreCaseExp(getName(), value);
     }
-    
+
     /**
      * @return An expression for a Database "NOT LIKE" query.
      */
@@ -162,7 +162,25 @@ public class Property<E> {
 
         return ExpressionFactory.inExp(getName(), values);
     }
-    
+
+    /**
+     * @return An expression for finding objects with values not in the given
+     *         set.
+     */
+    public Expression nin(E firstValue, E... moreValues) {
+
+        int moreValuesLength = moreValues != null ? moreValues.length : 0;
+
+        Object[] values = new Object[moreValuesLength + 1];
+        values[0] = firstValue;
+
+        if (moreValuesLength > 0) {
+            System.arraycopy(moreValues, 0, values, 1, moreValuesLength);
+        }
+
+        return ExpressionFactory.notInExp(getName(), values);
+    }
+
     /**
      * @return An expression for finding objects with values in the given set.
      */
@@ -171,6 +189,14 @@ public class Property<E> {
     }
 
     /**
+     * @return An expression for finding objects with values not in the given
+     *         set.
+     */
+    public Expression nin(Collection<E> values) {
+        return ExpressionFactory.notInExp(getName(), values);
+    }
+
+    /**
      * @return A greater than Expression.
      */
     public Expression gt(E value) {
@@ -273,7 +299,7 @@ public class Property<E> {
         node.setSemantics(PrefetchTreeNode.DISJOINT_PREFETCH_SEMANTICS);
         return node;
     }
-    
+
     public PrefetchTreeNode disjointById() {
         PrefetchTreeNode node = prefetch();
         node.setSemantics(PrefetchTreeNode.DISJOINT_BY_ID_PREFETCH_SEMANTICS);



Mime
View raw message