jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mreut...@apache.org
Subject svn commit: r1468409 - /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/util/TreeUtil.java
Date Tue, 16 Apr 2013 13:26:39 GMT
Author: mreutegg
Date: Tue Apr 16 13:26:39 2013
New Revision: 1468409

URL: http://svn.apache.org/r1468409
Log:
OAK-777: Get jcr:primaryType value as Type.NAME

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/util/TreeUtil.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/util/TreeUtil.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/util/TreeUtil.java?rev=1468409&r1=1468408&r2=1468409&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/util/TreeUtil.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/util/TreeUtil.java
Tue Apr 16 13:26:39 2013
@@ -42,7 +42,7 @@ public final class TreeUtil {
 
     @CheckForNull
     public static String getPrimaryTypeName(Tree tree) {
-        return getString(tree, JcrConstants.JCR_PRIMARYTYPE);
+        return getStringInternal(tree, JcrConstants.JCR_PRIMARYTYPE, Type.NAME);
     }
 
     @CheckForNull
@@ -57,9 +57,16 @@ public final class TreeUtil {
 
     @CheckForNull
     public static String getString(Tree tree, String propertyName) {
+        return getStringInternal(tree, propertyName, Type.STRING);
+    }
+
+    @CheckForNull
+    private static String getStringInternal(Tree tree,
+                                            String propertyName,
+                                            Type<? extends String> type) {
         PropertyState property = tree.getProperty(propertyName);
         if (property != null && !property.isArray()) {
-            return property.getValue(Type.STRING);
+            return property.getValue(type);
         } else {
             return null;
         }



Mime
View raw message