sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1469405 - in /sis/branches/JDK7/sis-metadata/src: main/java/org/apache/sis/metadata/ test/java/org/apache/sis/metadata/
Date Thu, 18 Apr 2013 16:16:32 GMT
Author: desruisseaux
Date: Thu Apr 18 16:16:32 2013
New Revision: 1469405

URL: http://svn.apache.org/r1469405
Log:
Renamed PropertyMap to ValueMap and MetadataStandard.asMap(...) to asValueMap(...) for emphasis
what the map is about.
This needs emerged from the increase in number of type of maps (value, class, information).

Added:
    sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/ValueMap.java
      - copied, changed from r1469394, sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/PropertyMap.java
Removed:
    sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/PropertyMap.java
Modified:
    sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/AbstractMetadata.java
    sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/KeyNamePolicy.java
    sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/MetadataMap.java
    sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/MetadataStandard.java
    sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/PropertyAccessor.java
    sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/Pruner.java
    sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/ValueExistencePolicy.java
    sis/branches/JDK7/sis-metadata/src/test/java/org/apache/sis/metadata/MetadataStandardTest.java

Modified: sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/AbstractMetadata.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/AbstractMetadata.java?rev=1469405&r1=1469404&r2=1469405&view=diff
==============================================================================
--- sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/AbstractMetadata.java
[UTF-8] (original)
+++ sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/AbstractMetadata.java
[UTF-8] Thu Apr 18 16:16:32 2013
@@ -129,7 +129,7 @@ public abstract class AbstractMetadata i
      *
      * {@section Note for implementors}
      * The default implementation uses Java reflection indirectly, by iterating over all
entries
-     * returned by {@link MetadataStandard#asMap(Object, KeyNamePolicy, ValueExistencePolicy)}.
+     * returned by {@link MetadataStandard#asValueMap(Object, KeyNamePolicy, ValueExistencePolicy)}.
      * Subclasses that override this method should usually not invoke {@code super.isEmpty()},
      * because the Java reflection will discover and process the properties defined in the
      * subclasses - which is usually not the intend when overriding a method.
@@ -187,16 +187,16 @@ public abstract class AbstractMetadata i
      *
      * <p>The default implementation is equivalent to the following method call:</p>
      * {@preformat java
-     *   return getStandard().asMap(this, KeyNamePolicy.JAVABEANS_PROPERTY, ValueExistencePolicy.NON_EMPTY);
+     *   return getStandard().asValueMap(this, KeyNamePolicy.JAVABEANS_PROPERTY, ValueExistencePolicy.NON_EMPTY);
      * }
      *
      * @return A view of this metadata object as a map.
      *
-     * @see MetadataStandard#asMap(Object, KeyNamePolicy, ValueExistencePolicy)
+     * @see MetadataStandard#asValueMap(Object, KeyNamePolicy, ValueExistencePolicy)
      */
     public synchronized Map<String,Object> asMap() {
         if (asMap == null) {
-            asMap = getStandard().asMap(this, KeyNamePolicy.JAVABEANS_PROPERTY, ValueExistencePolicy.NON_EMPTY);
+            asMap = getStandard().asValueMap(this, KeyNamePolicy.JAVABEANS_PROPERTY, ValueExistencePolicy.NON_EMPTY);
         }
         return asMap;
     }

Modified: sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/KeyNamePolicy.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/KeyNamePolicy.java?rev=1469405&r1=1469404&r2=1469405&view=diff
==============================================================================
--- sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/KeyNamePolicy.java
[UTF-8] (original)
+++ sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/KeyNamePolicy.java
[UTF-8] Thu Apr 18 16:16:32 2013
@@ -35,7 +35,7 @@ import org.opengis.annotation.UML;
  * @version 0.3
  * @module
  *
- * @see MetadataStandard#asMap(Object, KeyNamePolicy, ValueExistencePolicy)
+ * @see MetadataStandard#asValueMap(Object, KeyNamePolicy, ValueExistencePolicy)
  */
 public enum KeyNamePolicy {
     /**

Modified: sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/MetadataMap.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/MetadataMap.java?rev=1469405&r1=1469404&r2=1469405&view=diff
==============================================================================
--- sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/MetadataMap.java
[UTF-8] (original)
+++ sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/MetadataMap.java
[UTF-8] Thu Apr 18 16:16:32 2013
@@ -105,7 +105,7 @@ abstract class MetadataMap<V> extends Ab
 
         /**
          * Assumes that the underlying map is unmodifiable.
-         * Only {@link PropertyMap} supports this method.
+         * Only {@link ValueMap} supports this method.
          */
         @Override
         public void remove() {

Modified: sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/MetadataStandard.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/MetadataStandard.java?rev=1469405&r1=1469404&r2=1469405&view=diff
==============================================================================
--- sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/MetadataStandard.java
[UTF-8] (original)
+++ sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/MetadataStandard.java
[UTF-8] Thu Apr 18 16:16:32 2013
@@ -496,13 +496,13 @@ public class MetadataStandard {
      *
      * @see AbstractMetadata#asMap()
      */
-    public Map<String,Object> asMap(final Object metadata, final KeyNamePolicy keyPolicy,
+    public Map<String,Object> asValueMap(final Object metadata, final KeyNamePolicy
keyPolicy,
             final ValueExistencePolicy valuePolicy) throws ClassCastException
     {
         ensureNonNull("metadata",    metadata);
         ensureNonNull("keyPolicy",   keyPolicy);
         ensureNonNull("valuePolicy", valuePolicy);
-        return new PropertyMap(metadata, getAccessor(metadata.getClass(), true), keyPolicy,
valuePolicy);
+        return new ValueMap(metadata, getAccessor(metadata.getClass(), true), keyPolicy,
valuePolicy);
     }
 
     /**

Modified: sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/PropertyAccessor.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/PropertyAccessor.java?rev=1469405&r1=1469404&r2=1469405&view=diff
==============================================================================
--- sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/PropertyAccessor.java
[UTF-8] (original)
+++ sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/PropertyAccessor.java
[UTF-8] Thu Apr 18 16:16:32 2013
@@ -632,7 +632,7 @@ final class PropertyAccessor {
      * copy the new collection in their existing instance.
      *
      * <p>If the given index is out of bounds, then this method does nothing and return
{@code null}.
-     * We do that because the {@link PropertyMap#remove(Object)} method may invoke this method
with
+     * We do that because the {@link ValueMap#remove(Object)} method may invoke this method
with
      * an index of -1 if the {@link #indexOf(String, boolean)} method didn't found the property
name.
      * However the given value will be silently discarded, so index out-of-bounds shall be
used only
      * in the context of {@code remove} operations (this is not verified).</p>

Modified: sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/Pruner.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/Pruner.java?rev=1469405&r1=1469404&r2=1469405&view=diff
==============================================================================
--- sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/Pruner.java [UTF-8]
(original)
+++ sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/Pruner.java [UTF-8]
Thu Apr 18 16:16:32 2013
@@ -59,7 +59,7 @@ final class Pruner extends ThreadLocal<M
      * include empty (but non-null) values in order to allow us to set them to {@code null}.
      */
     private static Map<String, Object> asMap(final MetadataStandard standard, final
Object metadata, final boolean prune) {
-        return standard.asMap(metadata, KeyNamePolicy.JAVABEANS_PROPERTY, prune ?
+        return standard.asValueMap(metadata, KeyNamePolicy.JAVABEANS_PROPERTY, prune ?
                 ValueExistencePolicy.NON_NULL : ValueExistencePolicy.NON_EMPTY);
     }
 
@@ -67,8 +67,8 @@ final class Pruner extends ThreadLocal<M
      * Returns {@code true} if the value for the given entry is a primitive type.
      */
     private static boolean isPrimitive(final Map.Entry<String,Object> entry) {
-        return (entry instanceof PropertyMap.Property) &&
-                ((PropertyMap.Property) entry).getValueType().isPrimitive();
+        return (entry instanceof ValueMap.Property) &&
+                ((ValueMap.Property) entry).getValueType().isPrimitive();
     }
 
     /**

Modified: sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/ValueExistencePolicy.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/ValueExistencePolicy.java?rev=1469405&r1=1469404&r2=1469405&view=diff
==============================================================================
--- sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/ValueExistencePolicy.java
[UTF-8] (original)
+++ sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/ValueExistencePolicy.java
[UTF-8] Thu Apr 18 16:16:32 2013
@@ -18,8 +18,8 @@ package org.apache.sis.metadata;
 
 
 /**
- * Whatever {@link MetadataStandard#asMap MetadataStandard.asMap(…)} shall contain entries
- * for null values or empty collections. By default the map does not provide
+ * Whatever {@link MetadataStandard#asValueMap MetadataStandard.asValueMap(…)} shall contain
+ * entries for null values or empty collections. By default the map does not provide
  * {@linkplain java.util.Map.Entry entries} for {@code null} metadata properties or
  * {@linkplain java.util.Collection#isEmpty() empty} collections.
  * This enumeration allows control on this behavior.
@@ -29,7 +29,7 @@ package org.apache.sis.metadata;
  * @version 0.3
  * @module
  *
- * @see MetadataStandard#asMap(Object, KeyNamePolicy, ValueExistencePolicy)
+ * @see MetadataStandard#asValueMap(Object, KeyNamePolicy, ValueExistencePolicy)
  */
 public enum ValueExistencePolicy {
     /**

Copied: sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/ValueMap.java
(from r1469394, sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/PropertyMap.java)
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/ValueMap.java?p2=sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/ValueMap.java&p1=sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/PropertyMap.java&r1=1469394&r2=1469405&rev=1469405&view=diff
==============================================================================
--- sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/PropertyMap.java
[UTF-8] (original)
+++ sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/ValueMap.java [UTF-8]
Thu Apr 18 16:16:32 2013
@@ -35,9 +35,9 @@ import java.util.Objects;
  * @version 0.3
  * @module
  *
- * @see MetadataStandard#asMap(Object, KeyNamePolicy, ValueExistencePolicy)
+ * @see MetadataStandard#asValueMap(Object, KeyNamePolicy, ValueExistencePolicy)
  */
-final class PropertyMap extends MetadataMap<Object> {
+final class ValueMap extends MetadataMap<Object> {
     /**
      * The metadata object to wrap.
      */
@@ -56,7 +56,7 @@ final class PropertyMap extends Metadata
      * @param keyPolicy   Determines the string representation of keys in the map..
      * @param valuePolicy The behavior of this map toward null or empty values.
      */
-    PropertyMap(final Object metadata, final PropertyAccessor accessor,
+    ValueMap(final Object metadata, final PropertyAccessor accessor,
             final KeyNamePolicy keyPolicy, final ValueExistencePolicy valuePolicy)
     {
         super(accessor, keyPolicy);

Modified: sis/branches/JDK7/sis-metadata/src/test/java/org/apache/sis/metadata/MetadataStandardTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-metadata/src/test/java/org/apache/sis/metadata/MetadataStandardTest.java?rev=1469405&r1=1469404&r2=1469405&view=diff
==============================================================================
--- sis/branches/JDK7/sis-metadata/src/test/java/org/apache/sis/metadata/MetadataStandardTest.java
[UTF-8] (original)
+++ sis/branches/JDK7/sis-metadata/src/test/java/org/apache/sis/metadata/MetadataStandardTest.java
[UTF-8] Thu Apr 18 16:16:32 2013
@@ -116,18 +116,18 @@ public final strictfp class MetadataStan
     }
 
     /**
-     * Tests the {@link MetadataStandard#asMap(Object, KeyNamePolicy, ValueExistencePolicy)}
implementation.
-     * Note: this test duplicates {@link PropertyMapTest}, but is done here again as an integration
test.
+     * Tests the {@link MetadataStandard#asValueMap(Object, KeyNamePolicy, ValueExistencePolicy)}
implementation.
+     * Note: this test duplicates {@link ValueMapTest}, but is done here again as an integration
test.
      */
     @Test
-    public void testMap() {
+    public void testValueMap() {
         final DefaultCitation instance = new DefaultCitation(HardCodedCitations.EPSG);
-        final Map<String,Object> map = MetadataStandard.ISO_19115.asMap(instance,
+        final Map<String,Object> map = MetadataStandard.ISO_19115.asValueMap(instance,
                 KeyNamePolicy.JAVABEANS_PROPERTY, ValueExistencePolicy.NON_EMPTY);
         assertFalse("The properties map shall not be empty.", map.isEmpty());
         assertEquals("Unexpected number of properties.", 4, map.size());
         /*
-         * Verify the set of keys in the PropertyMap.
+         * Verify the set of keys in the ValueMap.
          *
          * Note: the iterator order (and consequently, the order of elements in the following
          * string representation) is determined by the @XmlType(…) annotation and verified
by
@@ -171,13 +171,13 @@ public final strictfp class MetadataStan
      * hash code values of all non-empty properties, plus the hash code of the interface.
      */
     @Test
-    @DependsOnMethod("testMap")
+    @DependsOnMethod("testValueMap")
     public void testHashCode() {
         final MetadataStandard std = MetadataStandard.ISO_19115;
         final DefaultCitation instance = HardCodedCitations.EPSG;
-        final Map<String,Object> map = std.asMap(instance,
+        final Map<String,Object> map = std.asValueMap(instance,
                 KeyNamePolicy.JAVABEANS_PROPERTY, ValueExistencePolicy.NON_EMPTY);
-        assertFalse(map.isEmpty()); // Actually 'testMap()' job, but verified for safety.
+        assertFalse(map.isEmpty()); // Actually 'testValueMap()' job, but verified for safety.
         assertEquals("hashCode()", new HashSet<>(map.values()).hashCode() + Citation.class.hashCode(),
                 std.hashCode(instance));
     }



Mime
View raw message