sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1479498 - in /sis/branches/JDK7/sis-metadata/src: main/java/org/apache/sis/metadata/TreeNode.java test/java/org/apache/sis/metadata/TreeNodeTest.java
Date Mon, 06 May 2013 08:47:23 GMT
Author: desruisseaux
Date: Mon May  6 08:47:16 2013
New Revision: 1479498

URL: http://svn.apache.org/r1479498
Log:
Minor documentation update and one minor test.

Modified:
    sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/TreeNode.java
    sis/branches/JDK7/sis-metadata/src/test/java/org/apache/sis/metadata/TreeNodeTest.java

Modified: sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/TreeNode.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/TreeNode.java?rev=1479498&r1=1479497&r2=1479498&view=diff
==============================================================================
--- sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/TreeNode.java [UTF-8]
(original)
+++ sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/TreeNode.java [UTF-8]
Mon May  6 08:47:16 2013
@@ -130,6 +130,10 @@ class TreeNode implements Node {
      * This value is cached on the assumption that users will ask for value or for children
soon
      * after they iterated over this node. The cached value is cleared after its first use.
      *
+     * <p>This value shall be either {@code null}, or the exact same value than what
a call to
+     * {@link #getUserObject()} would return, assuming that the underlying {@linkplain #metadata}
+     * object didn't changed.</p>
+     *
      * <p>The purpose of this cache is to avoid invoking (by reflection) the same getter
methods
      * twice in common situations like the {@link TreeTableView#toString()} implementation
or in
      * Graphical User Interface. However we may remove this field in any future SIS version
if
@@ -656,7 +660,8 @@ class TreeNode implements Node {
                         throw new IllegalArgumentException(Errors.format(Errors.Keys.ElementAlreadyPresent_1,
value));
                     }
                     delegate = siblings.childAt(indexInData, indexInList);
-                    // Do not set cachedValue, since 'value' may have been converted.
+                    // Do not set 'delegate.cachedValue = value', since 'value' may
+                    // have been converted by the setter method to an other value.
                     return;
                 }
             }

Modified: sis/branches/JDK7/sis-metadata/src/test/java/org/apache/sis/metadata/TreeNodeTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-metadata/src/test/java/org/apache/sis/metadata/TreeNodeTest.java?rev=1479498&r1=1479497&r2=1479498&view=diff
==============================================================================
--- sis/branches/JDK7/sis-metadata/src/test/java/org/apache/sis/metadata/TreeNodeTest.java
[UTF-8] (original)
+++ sis/branches/JDK7/sis-metadata/src/test/java/org/apache/sis/metadata/TreeNodeTest.java
[UTF-8] Mon May  6 08:47:16 2013
@@ -361,14 +361,16 @@ public final strictfp class TreeNodeTest
     private static int assertColumnContentEquals(final TreeTable.Node node, final TableColumn<?>
column,
             final Object[] values, int index)
     {
-        Object actual = node.getValue(column);
-        if (actual instanceof InternationalString) {
-            actual = ((InternationalString) actual).toString(Locale.ROOT);
+        final Object actual = node.getValue(column);
+        Object unlocalized = actual;
+        if (unlocalized instanceof InternationalString) {
+            unlocalized = ((InternationalString) unlocalized).toString(Locale.ROOT);
         }
-        assertEquals("values[" + index + ']', values[index++], actual);
+        assertEquals("values[" + index + ']', values[index++], unlocalized);
         for (final TreeTable.Node child : node.getChildren()) {
             index = assertColumnContentEquals(child, column, values, index);
         }
+        assertSame("Value shall be stable.", actual, node.getValue(column));
         return index;
     }
 }



Mime
View raw message