sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject [sis] branch geoapi-4.0 updated: Remove SimpleIdentifier.toWKT() because not needed anymore, and document why PropertyInformation extends SimpleIdentifier.
Date Tue, 30 Apr 2019 14:16:15 GMT
This is an automated email from the ASF dual-hosted git repository.

desruisseaux pushed a commit to branch geoapi-4.0
in repository https://gitbox.apache.org/repos/asf/sis.git


The following commit(s) were added to refs/heads/geoapi-4.0 by this push:
     new b280070  Remove SimpleIdentifier.toWKT() because not needed anymore, and document
why PropertyInformation extends SimpleIdentifier.
b280070 is described below

commit b28007053a1d3c92905099f1dfd9cc2568c40a77
Author: Martin Desruisseaux <martin.desruisseaux@geomatys.com>
AuthorDate: Tue Apr 30 16:15:32 2019 +0200

    Remove SimpleIdentifier.toWKT() because not needed anymore, and document why PropertyInformation
extends SimpleIdentifier.
---
 .../sis/internal/simple/SimpleIdentifier.java      | 31 +++-------------------
 .../apache/sis/metadata/PropertyInformation.java   |  5 +++-
 .../sis/internal/simple/SimpleIdentifierTest.java  | 12 ---------
 ide-project/NetBeans/nbproject/genfiles.properties |  2 +-
 ide-project/NetBeans/nbproject/project.xml         |  1 +
 5 files changed, 9 insertions(+), 42 deletions(-)

diff --git a/core/sis-metadata/src/main/java/org/apache/sis/internal/simple/SimpleIdentifier.java
b/core/sis-metadata/src/main/java/org/apache/sis/internal/simple/SimpleIdentifier.java
index d08bb5f..a264a9d 100644
--- a/core/sis-metadata/src/main/java/org/apache/sis/internal/simple/SimpleIdentifier.java
+++ b/core/sis-metadata/src/main/java/org/apache/sis/internal/simple/SimpleIdentifier.java
@@ -21,7 +21,6 @@ import java.io.Serializable;
 import org.opengis.util.InternationalString;
 import org.opengis.metadata.Identifier;
 import org.opengis.metadata.citation.Citation;
-import org.apache.sis.internal.util.Citations;
 import org.apache.sis.util.CharSequences;
 import org.apache.sis.util.Classes;
 import org.apache.sis.util.Deprecable;
@@ -201,9 +200,11 @@ public class SimpleIdentifier implements Identifier, Deprecable, Serializable
{
 
     /**
      * Returns a string representation of this identifier.
+     *
+     * <p>For customizing this string representation, see {@link #appendStringTo(StringBuilder)}.</p>
      */
     @Override
-    public String toString() {
+    public final String toString() {
         final String classname = Classes.getShortClassName(this);
         final StringBuilder buffer = new StringBuilder(classname.length() + CharSequences.length(code)
+ 10);
         buffer.append(classname).append('[');
@@ -232,30 +233,4 @@ public class SimpleIdentifier implements Identifier, Deprecable, Serializable
{
      */
     protected void appendStringTo(final StringBuilder buffer) {
     }
-
-    /**
-     * Returns a pseudo Well Known Text for this identifier.
-     * While this method is not defined in the {@link Identifier} interface, it is often
-     * defined in related interfaces like {@link org.opengis.referencing.IdentifiedObject}.
-     *
-     * @return pseudo Well Known Text for this identifier.
-     */
-    public String toWKT() {
-        final StringBuilder buffer = new StringBuilder(40).append("Id[");   // Consistent
with WKTKeywords.Id.
-        append(buffer, Citations.getIdentifier(authority, true));           // Do not invoke
getCodeSpace().
-        append(buffer.append(", "), code);
-        return buffer.append(']').toString();
-    }
-
-    /**
-     * Appends the given value in the given buffer between quotes, except if the
-     * given value is null in which case {@code null} is appended without quotes.
-     */
-    private static void append(final StringBuilder buffer, final String value) {
-        if (value == null) {
-            buffer.append("null");
-        } else {
-            buffer.append('"').append(value).append('"');
-        }
-    }
 }
diff --git a/core/sis-metadata/src/main/java/org/apache/sis/metadata/PropertyInformation.java
b/core/sis-metadata/src/main/java/org/apache/sis/metadata/PropertyInformation.java
index c388d1c..32e6f07 100644
--- a/core/sis-metadata/src/main/java/org/apache/sis/metadata/PropertyInformation.java
+++ b/core/sis-metadata/src/main/java/org/apache/sis/metadata/PropertyInformation.java
@@ -43,6 +43,9 @@ import org.apache.sis.util.logging.Logging;
  * but other types are allowed), instances of {@code PropertyInformation} are obtained
  * indirectly by the {@link MetadataStandard#asInformationMap(Class, KeyNamePolicy)} method.
  *
+ * <p>This class implements also the {@link org.opengis.metadata.Identifier} and {@link
CheckedContainer} interfaces.
+ * Those features are not directly used by this class, but is published in the {@link MetadataStandard}
javadoc.</p>
+ *
  * <div class="note"><b>API note:</b>
  * The rational for implementing {@code CheckedContainer} is to consider each {@code ExtendedElementInformation}
  * instance as the set of all possible values for the property. If the information had a
{@code contains(E)} method,
@@ -64,7 +67,7 @@ import org.apache.sis.util.logging.Logging;
  * @since 0.3
  * @module
  */
-final class PropertyInformation<E> extends SimpleIdentifier
+final class PropertyInformation<E> extends SimpleIdentifier           // Implementing
Identifier is part of SIS public API.
         implements ExtendedElementInformation, CheckedContainer<E>
 {
     /**
diff --git a/core/sis-metadata/src/test/java/org/apache/sis/internal/simple/SimpleIdentifierTest.java
b/core/sis-metadata/src/test/java/org/apache/sis/internal/simple/SimpleIdentifierTest.java
index 151c7f8..4bddc29 100644
--- a/core/sis-metadata/src/test/java/org/apache/sis/internal/simple/SimpleIdentifierTest.java
+++ b/core/sis-metadata/src/test/java/org/apache/sis/internal/simple/SimpleIdentifierTest.java
@@ -42,16 +42,4 @@ public final strictfp class SimpleIdentifierTest extends TestCase {
         assertEquals("SimpleIdentifier[“4326”]",      new SimpleIdentifier(null,    
 "4326", false).toString());
         assertEquals("SimpleIdentifier[]",            new SimpleIdentifier(null,       null,
 false).toString());
     }
-
-    /**
-     * Tests {@link SimpleIdentifier#toWKT()}.
-     */
-    @Test
-    public void testToWKT() {
-        final SimpleCitation authority = new SimpleCitation("EPSG");
-        assertEquals("Id[\"EPSG\", \"4326\"]", new SimpleIdentifier(authority, "4326", false).toWKT());
-        assertEquals("Id[\"EPSG\", null]",     new SimpleIdentifier(authority,  null,  false).toWKT());
-        assertEquals("Id[null, \"4326\"]",     new SimpleIdentifier(null,      "4326", false).toWKT());
-        assertEquals("Id[null, null]",         new SimpleIdentifier(null,       null,  false).toWKT());
-    }
 }
diff --git a/ide-project/NetBeans/nbproject/genfiles.properties b/ide-project/NetBeans/nbproject/genfiles.properties
index 2859e14..dbff901 100644
--- a/ide-project/NetBeans/nbproject/genfiles.properties
+++ b/ide-project/NetBeans/nbproject/genfiles.properties
@@ -3,6 +3,6 @@
 build.xml.data.CRC32=58e6b21c
 build.xml.script.CRC32=462eaba0
 build.xml.stylesheet.CRC32=28e38971@1.53.1.46
-nbproject/build-impl.xml.data.CRC32=f55f037a
+nbproject/build-impl.xml.data.CRC32=8f8309b2
 nbproject/build-impl.xml.script.CRC32=a7689f96
 nbproject/build-impl.xml.stylesheet.CRC32=3a2fa800@1.89.1.48
diff --git a/ide-project/NetBeans/nbproject/project.xml b/ide-project/NetBeans/nbproject/project.xml
index c4f6cda..7627d51 100644
--- a/ide-project/NetBeans/nbproject/project.xml
+++ b/ide-project/NetBeans/nbproject/project.xml
@@ -118,6 +118,7 @@
             <word>polyline</word>
             <word>polylines</word>
             <word>preprocessing</word>
+            <word>programmatically</word>
             <word>recursivity</word>
             <word>scanline</word>
             <word>spliterator</word>


Mime
View raw message