incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r1325138 - in /sling/trunk/bundles/jcr/resource: pom.xml src/main/java/org/apache/sling/jcr/resource/JcrPropertyMap.java
Date Thu, 12 Apr 2012 06:57:31 GMT
Author: cziegeler
Date: Thu Apr 12 06:57:30 2012
New Revision: 1325138

URL: http://svn.apache.org/viewvc?rev=1325138&view=rev
Log:
SLING-2448 : org.apache.sling.jcr.resource should embed com.google.common.collect.MapDifference.
Apply patch from Robert Munteanu

Modified:
    sling/trunk/bundles/jcr/resource/pom.xml
    sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/JcrPropertyMap.java

Modified: sling/trunk/bundles/jcr/resource/pom.xml
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/resource/pom.xml?rev=1325138&r1=1325137&r2=1325138&view=diff
==============================================================================
--- sling/trunk/bundles/jcr/resource/pom.xml (original)
+++ sling/trunk/bundles/jcr/resource/pom.xml Thu Apr 12 06:57:30 2012
@@ -100,7 +100,6 @@
                         <Embed-Dependency>
                             jackrabbit-classloader;inline="org/apache/jackrabbit/net/**|org/apache/jackrabbit/classloader/Util.*",
                             jackrabbit-jcr-commons;inline="org/apache/jackrabbit/util/ISO9075.*|org/apache/jackrabbit/name/QName.*|org/apache/jackrabbit/util/XMLChar.*|org/apache/jackrabbit/util/Text.*",
-                            guava;inline="com/google/common/collect/Maps*.*|com/google/common/base/Preconditions.*|com/google/common/primitives/Ints.*"
                         </Embed-Dependency>
 
                         <Sling-Namespaces>
@@ -197,12 +196,6 @@
             <scope>provided</scope>
         </dependency>
         <dependency>
-            <groupId>com.google.guava</groupId>
-            <artifactId>guava</artifactId>
-            <version>r09</version>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
             <groupId>org.apache.sling</groupId>
             <artifactId>adapter-annotations</artifactId>
             <version>1.0.0</version>

Modified: sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/JcrPropertyMap.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/JcrPropertyMap.java?rev=1325138&r1=1325137&r2=1325138&view=diff
==============================================================================
--- sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/JcrPropertyMap.java
(original)
+++ sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/JcrPropertyMap.java
Thu Apr 12 06:57:30 2012
@@ -47,8 +47,6 @@ import org.apache.sling.jcr.resource.int
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import com.google.common.collect.Maps;
-
 /**
  * An implementation of the value map based on a JCR node.
  * @see JcrModifiablePropertyMap
@@ -210,7 +208,7 @@ public class JcrPropertyMap
         if (cache.size() == valueCache.size()) {
             sourceMap = valueCache;
         } else {
-            sourceMap = Maps.transformEntries(cache, entryTransformer);
+            sourceMap = transformEntries(cache);
         }
         return Collections.unmodifiableSet(sourceMap.entrySet());
     }
@@ -232,7 +230,7 @@ public class JcrPropertyMap
         if (cache.size() == valueCache.size()) {
             sourceMap = valueCache;
         } else {
-            sourceMap = Maps.transformEntries(cache, entryTransformer);
+            sourceMap = transformEntries(cache);
         }
         return Collections.unmodifiableCollection(sourceMap.values());
     }
@@ -484,13 +482,15 @@ public class JcrPropertyMap
         }
         return type;
     }
-
-    private static Maps.EntryTransformer<String, JcrPropertyMapCacheEntry, Object>
entryTransformer = new Maps.EntryTransformer<String, JcrPropertyMapCacheEntry, Object>()
{
-
-        public Object transformEntry(String key, JcrPropertyMapCacheEntry value) {
-            return value.getDefaultValueOrNull();
-        }
-    };
+    
+	private Map<String, Object> transformEntries( Map<String, JcrPropertyMapCacheEntry>
map) {
+		
+		Map<String, Object> transformedEntries = new LinkedHashMap<String, Object>(map.size());
+		for ( Map.Entry<String, JcrPropertyMapCacheEntry> entry : map.entrySet() )
+			transformedEntries.put(entry.getKey(), entry.getValue().getDefaultValueOrNull());
+		
+		return transformedEntries;
+	}
 
     /**
      * This is an extended version of the object input stream which uses the



Mime
View raw message