jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1344277 - in /jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr: NodeDelegate.java NodeImpl.java PropertyDelegate.java
Date Wed, 30 May 2012 14:37:25 GMT
Author: mduerig
Date: Wed May 30 14:37:25 2012
New Revision: 1344277

URL: http://svn.apache.org/viewvc?rev=1344277&view=rev
Log:
OAK-37: Use nullability annotation to enforce/document API contract

Modified:
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeDelegate.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeImpl.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/PropertyDelegate.java

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeDelegate.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeDelegate.java?rev=1344277&r1=1344276&r2=1344277&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeDelegate.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeDelegate.java
Wed May 30 14:37:25 2012
@@ -101,9 +101,7 @@ public class NodeDelegate extends ItemDe
             return getPath();
         }
         else {
-            CoreValue value = pd.getValue();
-            assert value != null; // since jcr:uuid is a single valued property
-            return value.toString();
+            return pd.getValue().toString();
         }
     }
 

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeImpl.java?rev=1344277&r1=1344276&r2=1344277&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeImpl.java
Wed May 30 14:37:25 2012
@@ -755,9 +755,7 @@ public class NodeImpl extends ItemImpl i
         } else {
             List<CoreValue> values = new ArrayList<CoreValue>();
             values.add(cv);
-            Iterable<CoreValue> existingValues = mixins.getValues();
-            assert existingValues != null; // since jcr:mixinTypes is a multi valued property
-            for (CoreValue existingValue : existingValues) {
+            for (CoreValue existingValue : mixins.getValues()) {
                 if (!values.contains(existingValue)) {
                     values.add(existingValue);
                 }

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/PropertyDelegate.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/PropertyDelegate.java?rev=1344277&r1=1344276&r2=1344277&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/PropertyDelegate.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/PropertyDelegate.java
Wed May 30 14:37:25 2012
@@ -22,7 +22,6 @@ import org.apache.jackrabbit.oak.api.Tre
 import org.apache.jackrabbit.oak.api.Tree.Status;
 import org.apache.jackrabbit.oak.commons.PathUtils;
 
-import javax.annotation.CheckForNull;
 import javax.annotation.Nonnull;
 import javax.jcr.InvalidItemStateException;
 import javax.jcr.Value;
@@ -98,22 +97,23 @@ public class PropertyDelegate extends It
 
     /**
      * Get the value of the property
-     * @return  value or {@code null} if multi values
+     * @return  the value of the property
+     * @throws IllegalStateException  if {@code isMultivalue()} is {@code true}.
+     *
      */
-    @CheckForNull
+    @Nonnull
     public CoreValue getValue() throws InvalidItemStateException {
-        PropertyState state = getPropertyState();
-        return state.isArray() ? null : state.getValue();
+        return getPropertyState().getValue();
     }
 
     /**
      * Get the value of the property
-     * @return  value or {@code null} if single valued
+     * @return  the values of the property
+     * @throws IllegalStateException  if {@code isMultivalue()} is {@code false}.
      */
-    @CheckForNull
+    @Nonnull
     public Iterable<CoreValue> getValues() throws InvalidItemStateException {
-        PropertyState state = getPropertyState();
-        return state == null ? null : state.getValues();
+        return getPropertyState().getValues();
     }
 
     /**
@@ -247,6 +247,7 @@ public class PropertyDelegate extends It
 
     //------------------------------------------------------------< private >---
 
+    @Nonnull
     private PropertyState getPropertyState() throws InvalidItemStateException {
         resolve();
         if (parent == null) {
@@ -256,6 +257,7 @@ public class PropertyDelegate extends It
         return propertyState;
     }
 
+    @Nonnull
     private Tree getParentTree() throws InvalidItemStateException {
         resolve();
         if (parent == null) {



Mime
View raw message