sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1786862 - /sis/trunk/core/sis-referencing-by-identifiers/src/main/java/org/apache/sis/referencing/gazetteer/
Date Tue, 14 Mar 2017 09:36:09 GMT
Author: desruisseaux
Date: Tue Mar 14 09:36:09 2017
New Revision: 1786862

URL: http://svn.apache.org/viewvc?rev=1786862&view=rev
Log:
Reduce the occurrence of non-public AbstractLocationType in public API and add documentation
about upcomming API change (pending GeoAPI approval).

Modified:
    sis/trunk/core/sis-referencing-by-identifiers/src/main/java/org/apache/sis/referencing/gazetteer/AbstractLocation.java
    sis/trunk/core/sis-referencing-by-identifiers/src/main/java/org/apache/sis/referencing/gazetteer/LocationFormat.java
    sis/trunk/core/sis-referencing-by-identifiers/src/main/java/org/apache/sis/referencing/gazetteer/MilitaryGridReferenceSystem.java
    sis/trunk/core/sis-referencing-by-identifiers/src/main/java/org/apache/sis/referencing/gazetteer/ModifiableLocationType.java
    sis/trunk/core/sis-referencing-by-identifiers/src/main/java/org/apache/sis/referencing/gazetteer/ReferencingByIdentifiers.java

Modified: sis/trunk/core/sis-referencing-by-identifiers/src/main/java/org/apache/sis/referencing/gazetteer/AbstractLocation.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing-by-identifiers/src/main/java/org/apache/sis/referencing/gazetteer/AbstractLocation.java?rev=1786862&r1=1786861&r2=1786862&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing-by-identifiers/src/main/java/org/apache/sis/referencing/gazetteer/AbstractLocation.java
[UTF-8] (original)
+++ sis/trunk/core/sis-referencing-by-identifiers/src/main/java/org/apache/sis/referencing/gazetteer/AbstractLocation.java
[UTF-8] Tue Mar 14 09:36:09 2017
@@ -88,10 +88,24 @@ public abstract class AbstractLocation {
      * Creates a new location for the given geographic identifier.
      * This constructor accepts {@code null} arguments, but this is not recommended.
      *
+     * <div class="warning"><b>Upcoming API change — generalization</b><br>
+     * in a future SIS version, the type of {@code type} argument may be generalized to the
+     * {@code org.opengis.referencing.gazetteer.Location} interface.
+     * This change is pending GeoAPI revision.</div>
+     *
      * @param type        the description of the nature of this geographic identifier.
      * @param identifier  the geographic identifier to be returned by {@link #getGeographicIdentifier()}.
      */
-    protected AbstractLocation(final AbstractLocationType type, final CharSequence identifier)
{
+    protected AbstractLocation(final ModifiableLocationType type, final CharSequence identifier)
{
+        this.type       = type;
+        this.identifier = identifier;
+    }
+
+    /**
+     * Temporary workaround for the lack of {@code LocationType} interface and {@code AbstractLocationType}
+     * being package-private. We do not want to expose {@code AbstractLocationType} in public
API for now.
+     */
+    AbstractLocation(final AbstractLocationType type, final CharSequence identifier) {
         this.type       = type;
         this.identifier = identifier;
     }
@@ -201,6 +215,11 @@ public abstract class AbstractLocation {
     /**
      * Returns a description of the nature of this geographic identifier.
      *
+     * <div class="warning"><b>Upcoming API change — generalization</b><br>
+     * in a future SIS version, the type of returned element may be generalized to the
+     * {@code org.opengis.referencing.gazetteer.Location} interface.
+     * This change is pending GeoAPI revision.</div>
+     *
      * @return the nature of the identifier and its associated geographic location.
      */
     public AbstractLocationType getLocationType() {
@@ -211,7 +230,7 @@ public abstract class AbstractLocation {
      * Returns the organization responsible for defining the characteristics of the location
instance.
      * The default implementation returns the {@linkplain ModifiableLocationType#getOwner()
owner}.
      *
-     * <div class="warning"><b>Warning:</b>
+     * <div class="warning"><b>Upcoming API change — generalization</b><br>
      * in a future SIS version, the type of returned element may be generalized to the
      * {@code org.opengis.metadata.citation.Party} interface. This change is pending
      * GeoAPI revision for upgrade from ISO 19115:2003 to ISO 19115:2014.</div>
@@ -230,7 +249,7 @@ public abstract class AbstractLocation {
      * Returns location instances of a different location type, for which this location instance
is a sub-division.
      * The default implementation returns an empty list.
      *
-     * <div class="warning"><b>Warning:</b>
+     * <div class="warning"><b>Upcoming API change — generalization</b><br>
      * in a future SIS version, the type of collection elements may be generalized
      * to the {@code org.opengis.referencing.gazetteer.Location} interface.
      * This change is pending GeoAPI revision.</div>
@@ -247,7 +266,7 @@ public abstract class AbstractLocation {
      * Returns location instances of a different location type which subdivides this location
instance.
      * The default implementation returns an empty list.
      *
-     * <div class="warning"><b>Warning:</b>
+     * <div class="warning"><b>Upcoming API change — generalization</b><br>
      * in a future SIS version, the type of collection elements may be generalized
      * to the {@code org.opengis.referencing.gazetteer.Location} interface.
      * This change is pending GeoAPI revision.</div>

Modified: sis/trunk/core/sis-referencing-by-identifiers/src/main/java/org/apache/sis/referencing/gazetteer/LocationFormat.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing-by-identifiers/src/main/java/org/apache/sis/referencing/gazetteer/LocationFormat.java?rev=1786862&r1=1786861&r2=1786862&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing-by-identifiers/src/main/java/org/apache/sis/referencing/gazetteer/LocationFormat.java
[UTF-8] (original)
+++ sis/trunk/core/sis-referencing-by-identifiers/src/main/java/org/apache/sis/referencing/gazetteer/LocationFormat.java
[UTF-8] Tue Mar 14 09:36:09 2017
@@ -198,7 +198,7 @@ public class LocationFormat extends Tabu
     /**
      * Writes a textual representation of the given location in the given stream or buffer.
      *
-     * <div class="warning"><b>Warning:</b>
+     * <div class="warning"><b>Upcoming API change — generalization</b><br>
      * in a future SIS version, the type of {@code location} parameter may be generalized
      * to the {@code org.opengis.referencing.gazetteer.Location} interface.
      * This change is pending GeoAPI revision.</div>

Modified: sis/trunk/core/sis-referencing-by-identifiers/src/main/java/org/apache/sis/referencing/gazetteer/MilitaryGridReferenceSystem.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing-by-identifiers/src/main/java/org/apache/sis/referencing/gazetteer/MilitaryGridReferenceSystem.java?rev=1786862&r1=1786861&r2=1786862&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing-by-identifiers/src/main/java/org/apache/sis/referencing/gazetteer/MilitaryGridReferenceSystem.java
[UTF-8] (original)
+++ sis/trunk/core/sis-referencing-by-identifiers/src/main/java/org/apache/sis/referencing/gazetteer/MilitaryGridReferenceSystem.java
[UTF-8] Tue Mar 14 09:36:09 2017
@@ -277,7 +277,7 @@ public class MilitaryGridReferenceSystem
      * ("Relax constraint on placement of this()/super() call in constructors").
      */
     @Workaround(library="JDK", version="1.8")
-    private static AbstractLocationType[] types() {
+    private static ModifiableLocationType[] types() {
         final ModifiableLocationType gzd    = new ModifiableLocationType(Resources.formatInternational(Resources.Keys.GridZoneDesignator));
         final ModifiableLocationType square = new ModifiableLocationType(Resources.formatInternational(Resources.Keys.SquareIdentifier100));
         final ModifiableLocationType coord  = new ModifiableLocationType(Resources.formatInternational(Resources.Keys.GridCoordinates));
@@ -285,14 +285,14 @@ public class MilitaryGridReferenceSystem
         coord .addIdentification(Vocabulary.formatInternational(Vocabulary.Keys.Coordinate));
         square.addParent(gzd);
         coord .addParent(square);
-        return new AbstractLocationType[] {gzd};
+        return new ModifiableLocationType[] {gzd};
     }
 
     /**
      * Returns the first location types, which should be the grid zone identifier.
      */
     final AbstractLocationType rootType() {
-        return super.getLocationTypes().get(0);     // Use super.… for protecting from
method overriding.
+        return locationTypes.get(0);
     }
 
     /**
@@ -636,8 +636,8 @@ public class MilitaryGridReferenceSystem
          * Decodes the given MGRS reference into a position and an envelope.
          * The Coordinate Reference System (CRS) associated to the returned position depends
on the given reference.
          *
-         * <div class="warning"><b>Warning:</b>
-         * in a future SIS version, the type of returned elements may be generalized
+         * <div class="warning"><b>Upcoming API change — generalization</b><br>
+         * in a future SIS version, the type of returned element may be generalized
          * to the {@code org.opengis.referencing.gazetteer.Location} interface.
          * This change is pending GeoAPI revision.</div>
          *

Modified: sis/trunk/core/sis-referencing-by-identifiers/src/main/java/org/apache/sis/referencing/gazetteer/ModifiableLocationType.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing-by-identifiers/src/main/java/org/apache/sis/referencing/gazetteer/ModifiableLocationType.java?rev=1786862&r1=1786861&r2=1786862&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing-by-identifiers/src/main/java/org/apache/sis/referencing/gazetteer/ModifiableLocationType.java
[UTF-8] (original)
+++ sis/trunk/core/sis-referencing-by-identifiers/src/main/java/org/apache/sis/referencing/gazetteer/ModifiableLocationType.java
[UTF-8] Tue Mar 14 09:36:09 2017
@@ -368,7 +368,7 @@ public class ModifiableLocationType exte
      * If no organization has been explicitely set, then this method inherits the value from
      * the parents providing that all parents specify the same organization.
      *
-     * <div class="warning"><b>Warning:</b>
+     * <div class="warning"><b>Upcoming API change — generalization</b><br>
      * in a future SIS version, the type of returned element may be generalized to the
      * {@code org.opengis.metadata.citation.Party} interface. This change is pending
      * GeoAPI revision for upgrade from ISO 19115:2003 to ISO 19115:2014.</div>
@@ -393,7 +393,7 @@ public class ModifiableLocationType exte
      * The given value is typically an instance of {@link DefaultOrganisation}.
      * For an alternative where only the organization name is specified, see {@link #setOwner(CharSequence)}.
      *
-     * <div class="warning"><b>Warning:</b>
+     * <div class="warning"><b>Upcoming API change — generalization</b><br>
      * in a future SIS version, the argument type may be generalized to the
      * {@code org.opengis.metadata.citation.Party} interface. This change is pending
      * GeoAPI revision for upgrade from ISO 19115:2003 to ISO 19115:2014.</div>
@@ -505,7 +505,7 @@ public class ModifiableLocationType exte
      * the reference system is always null. The reference system is defined when the location
types are
      * given to the {@link ReferencingByIdentifiers} constructor for example.
      *
-     * <div class="warning"><b>Warning:</b>
+     * <div class="warning"><b>Upcoming API change — generalization</b><br>
      * in a future SIS version, the type of returned element may be generalized to the
      * {@code org.opengis.referencing.gazetteer.ReferenceSystemUsingIdentifiers} interface.
      * This change is pending GeoAPI revision.</div>

Modified: sis/trunk/core/sis-referencing-by-identifiers/src/main/java/org/apache/sis/referencing/gazetteer/ReferencingByIdentifiers.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing-by-identifiers/src/main/java/org/apache/sis/referencing/gazetteer/ReferencingByIdentifiers.java?rev=1786862&r1=1786861&r2=1786862&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing-by-identifiers/src/main/java/org/apache/sis/referencing/gazetteer/ReferencingByIdentifiers.java
[UTF-8] (original)
+++ sis/trunk/core/sis-referencing-by-identifiers/src/main/java/org/apache/sis/referencing/gazetteer/ReferencingByIdentifiers.java
[UTF-8] Tue Mar 14 09:36:09 2017
@@ -99,7 +99,7 @@ public class ReferencingByIdentifiers ex
      *
      * @see #getLocationTypes()
      */
-    private final List<AbstractLocationType> locationTypes;
+    final List<AbstractLocationType> locationTypes;
 
     /**
      * Creates a reference system from the given properties.
@@ -163,15 +163,16 @@ public class ReferencingByIdentifiers ex
      * {@link ModifiableLocationType#snapshot(ReferenceSystemUsingIdentifiers, LocationType...)}.
      * Changes in the given location types after construction will not affect this {@code
ReferencingByIdentifiers}.
      *
-     * <div class="warning"><b>Warning:</b> In a future SIS version, the
type of array elements may be
-     * generalized to the {@code org.opengis.referencing.gazetteer.LocationType} interface.
+     * <div class="warning"><b>Upcoming API change — generalization</b><br>
+     * In a future SIS version, the type of array elements may be generalized to the
+     * {@code org.opengis.referencing.gazetteer.LocationType} interface.
      * This change is pending GeoAPI revision.</div>
      *
      * @param properties  the properties to be given to the reference system.
      * @param types       description of location type(s) in the spatial reference system.
      */
     @SuppressWarnings("ThisEscapedInObjectConstruction")
-    public ReferencingByIdentifiers(final Map<String,?> properties, final AbstractLocationType...
types) {
+    public ReferencingByIdentifiers(final Map<String,?> properties, final ModifiableLocationType...
types) {
         super(properties);
         theme = Types.toInternationalString(properties, THEME_KEY);
         overallOwner = Containers.property(properties, OVERALL_OWNER_KEY, AbstractParty.class);
@@ -197,7 +198,7 @@ public class ReferencingByIdentifiers ex
     /**
      * Authority with overall responsibility for the spatial reference system.
      *
-     * <div class="warning"><b>Warning:</b>
+     * <div class="warning"><b>Upcoming API change — generalization</b><br>
      * in a future SIS version, the type of returned element may be generalized to the
      * {@code org.opengis.metadata.citation.Party} interface. This change is pending
      * GeoAPI revision for upgrade from ISO 19115:2003 to ISO 19115:2014.</div>
@@ -215,12 +216,17 @@ public class ReferencingByIdentifiers ex
      * Description of location type(s) in the spatial reference system.
      * The collection returned by this method is unmodifiable.
      *
+     * <div class="warning"><b>Upcoming API change — generalization</b><br>
+     * in a future SIS version, the type of elements type may be generalized to the
+     * {@code org.opengis.referencing.gazetteer.Location} interface.
+     * This change is pending GeoAPI revision.</div>
+     *
      * @return description of location type(s) in the spatial reference system.
      *
      * @see ModifiableLocationType#getReferenceSystem()
      */
     @SuppressWarnings("ReturnOfCollectionOrArrayField")         // Because the collection
is unmodifiable.
-    public List<AbstractLocationType> getLocationTypes() {
+    public List<? extends AbstractLocationType> getLocationTypes() {
         return locationTypes;
     }
 
@@ -261,8 +267,8 @@ public class ReferencingByIdentifiers ex
             }
             default: {
                 // Theme and owner are metadata, so they can be ignored.
-                return Utilities.deepEquals(getLocationTypes(),
-                        ((ReferencingByIdentifiers) object).getLocationTypes(), mode);
+                final ReferencingByIdentifiers that = (ReferencingByIdentifiers) object;
+                return Utilities.deepEquals(locationTypes, that.locationTypes, mode);
             }
         }
     }



Mime
View raw message