sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1478416 - in /sis/branches/JDK7/sis-metadata/src: main/java/org/apache/sis/metadata/ test/java/org/apache/sis/metadata/
Date Thu, 02 May 2013 15:38:37 GMT
Author: desruisseaux
Date: Thu May  2 15:38:37 2013
New Revision: 1478416

URL: http://svn.apache.org/r1478416
Log:
Removed (for now) the AbstractMetadata.append(Object) method.

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/MetadataStandard.java
    sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/PropertyAccessor.java
    sis/branches/JDK7/sis-metadata/src/test/java/org/apache/sis/metadata/MetadataStandardTest.java
    sis/branches/JDK7/sis-metadata/src/test/java/org/apache/sis/metadata/PropertyAccessorTest.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=1478416&r1=1478415&r2=1478416&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 May  2 15:38:37 2013
@@ -23,8 +23,6 @@ import org.apache.sis.util.LenientCompar
 import org.apache.sis.util.collection.TreeTable;
 import org.apache.sis.util.logging.Logging;
 
-import static org.apache.sis.util.ArgumentChecks.ensureNonNull;
-
 
 /**
  * Provides basic operations using Java reflection for metadata implementations.
@@ -45,7 +43,6 @@ import static org.apache.sis.util.Argume
  *
  * <ul>
  *   <li>{@link #prune()}</li>
- *   <li>{@link #append(Object)}</li>
  *   <li>{@link #asMap()} with {@code put} operations</li>
  * </ul>
  *
@@ -154,24 +151,6 @@ public abstract class AbstractMetadata i
     }
 
     /**
-     * Appends to this metadata all non-empty values from the specified metadata. The {@code
source} metadata
-     * must implements the same metadata interface (defined by the {@linkplain #getStandard()
standard}) than
-     * this class, but doesn't need to be the same implementation class.
-     * The default implementation performs the copy using Java reflections.
-     *
-     * @param  source The metadata to copy values from.
-     * @throws ClassCastException if the specified metadata doesn't implements the expected
-     *         metadata interface.
-     * @throws UnmodifiableMetadataException if this class doesn't define {@code set*(…)}
methods
-     *         corresponding to the {@code get*()} methods found in the implemented interface,
or
-     *         if this instance is not modifiable for some other reason.
-     */
-    public void append(final Object source) throws ClassCastException, UnmodifiableMetadataException
{
-        ensureNonNull("source", source);
-        getStandard().append(source, this);
-    }
-
-    /**
      * Returns a view of the property values in a {@link Map}. The map is backed by this
metadata
      * object, so changes in the underlying metadata object are immediately reflected in
the map
      * and conversely.

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=1478416&r1=1478415&r2=1478416&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 May  2 15:38:37 2013
@@ -644,37 +644,6 @@ public class MetadataStandard {
     }
 
     /**
-     * Appends all non-empty metadata from source to target.
-     * The source must implements the same metadata interface than the target.
-     *
-     * <p>If the source contains any null or empty properties, then those properties
will
-     * not overwrite the corresponding properties in the destination metadata.</p>
-     *
-     * @param  source The metadata to copy.
-     * @param  target The target metadata.
-     * @throws ClassCastException if the source or target object don't
-     *         implements a metadata interface of the expected package.
-     * @throws UnmodifiableMetadataException if the target metadata is unmodifiable,
-     *         or if at least one setter method was required but not found.
-     *
-     * @see ModifiableMetadata#clone()
-     */
-    public void append(final Object source, final Object target)
-            throws ClassCastException, UnmodifiableMetadataException
-    {
-        ensureNonNull("target", target);
-        final PropertyAccessor accessor = getAccessor(target.getClass(), true);
-        if (!accessor.type.isInstance(source)) {
-            ensureNonNull("source", source);
-            throw new ClassCastException(Errors.format(Errors.Keys.IllegalArgumentClass_3,
-                    "source", accessor.type, source.getClass()));
-        }
-        if (!accessor.append(source, target)) {
-            throw new UnmodifiableMetadataException(Errors.format(Errors.Keys.UnmodifiableMetadata));
-        }
-    }
-
-    /**
      * Compares the two specified metadata objects.
      * The two metadata arguments shall be implementations of a metadata interface defined
by
      * this {@code MetadataStandard}, otherwise an exception will be thrown. However the
two

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=1478416&r1=1478415&r2=1478416&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 May  2 15:38:37 2013
@@ -67,8 +67,8 @@ import static org.apache.sis.util.collec
  * <ul>
  *   <li>The standard properties defined by the GeoAPI (or other standard) interfaces.
  *       Those properties are the only one accessible by most methods in this class,
- *       except {@link #equals(Object, Object, ComparisonMode, boolean)},
- *       {@link #append(Object, Object)} and {@link #freeze(Object)}.</li>
+ *       except {@link #equals(Object, Object, ComparisonMode, boolean)} and
+ *       {@link #freeze(Object)}.</li>
  *
  *   <li>Extra properties defined by the {@link IdentifiedObject} interface. Those
properties
  *       invisible in the ISO 19115 model, but appears in ISO 19139 XML marshalling. So we
do

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=1478416&r1=1478415&r2=1478416&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 May  2 15:38:37 2013
@@ -89,26 +89,6 @@ public final strictfp class MetadataStan
     }
 
     /**
-     * Tests appending values. For this test, we need to use a class that doesn't have any
{@code getIdentifiers()}
-     * method inherited from GeoAPI interfaces. The class will inherit the {@code getIdentifiers()}
method defined
-     * by SIS in the parent class, which doesn't have corresponding {@code setIdentifiers(...)}
method.
-     */
-    @Test
-    public void testAppend() {
-        final AbstractCompleteness source = new AbstractCompleteness();
-        final AbstractCompleteness target = new AbstractCompleteness();
-        source.setMeasureDescription(new SimpleInternationalString("Some description"));
-        target.getStandard().append(source, target);
-        assertEquals("Copy of measureDescription:", "Some description", target.getMeasureDescription().toString());
-        assertEquals("Copy of measureDescription:", source, target);
-
-        source.setMeasureDescription(null);
-        target.getStandard().append(source, target);
-        assertEquals("Measure description should not have been removed, since we skipped
null values.",
-                "Some description", target.getMeasureDescription().toString());
-    }
-
-    /**
      * Tests the {@link MetadataStandard#equals(Object, Object, ComparisonMode)} method.
      */
     @Test

Modified: sis/branches/JDK7/sis-metadata/src/test/java/org/apache/sis/metadata/PropertyAccessorTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-metadata/src/test/java/org/apache/sis/metadata/PropertyAccessorTest.java?rev=1478416&r1=1478415&r2=1478416&view=diff
==============================================================================
--- sis/branches/JDK7/sis-metadata/src/test/java/org/apache/sis/metadata/PropertyAccessorTest.java
[UTF-8] (original)
+++ sis/branches/JDK7/sis-metadata/src/test/java/org/apache/sis/metadata/PropertyAccessorTest.java
[UTF-8] Thu May  2 15:38:37 2013
@@ -327,26 +327,6 @@ public final strictfp class PropertyAcce
     }
 
     /**
-     * Tests the {@link PropertyAccessor#append(Object, Object)} method.
-     */
-    @Test
-    public void testAppend() {
-        final DefaultCitation original = HardCodedCitations.ISO;
-        final DefaultCitation copy = new DefaultCitation();
-        final PropertyAccessor accessor = createPropertyAccessor();
-        assertTrue("The copy should have modified the destination.", accessor.append(original,
copy));
-        assertEquals("International Organization for Standardization", copy.getTitle().toString());
-
-        Collection<?> values = copy.getAlternateTitles();
-        assertNotSame("Collections shall have been copied.", original.getAlternateTitles(),
values);
-        assertEquals("ISO", getSingleton(values).toString());
-
-        values = copy.getPresentationForms();
-        assertNotSame("Collections shall have been copied.", original.getPresentationForms(),
values);
-        assertEquals(PresentationForm.DOCUMENT_DIGITAL, getSingleton(values));
-    }
-
-    /**
      * Tests the equals methods.
      */
     @Test



Mime
View raw message