sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1597163 - in /sis/branches/JDK8/core/sis-feature/src: main/java/org/apache/sis/feature/ test/java/org/apache/sis/feature/
Date Fri, 23 May 2014 19:19:00 GMT
Author: desruisseaux
Date: Fri May 23 19:18:59 2014
New Revision: 1597163

URL: http://svn.apache.org/r1597163
Log:
Retrofiting in GeoAPI step 1: class AbstractIdentifiedType implements IdentifiedType.

Modified:
    sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/AbstractIdentifiedType.java
    sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/DefaultAssociationRole.java
    sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/DefaultFeatureType.java
    sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/FeatureFormat.java
    sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/Validator.java
    sis/branches/JDK8/core/sis-feature/src/test/java/org/apache/sis/feature/DefaultFeatureTypeTest.java

Modified: sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/AbstractIdentifiedType.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/AbstractIdentifiedType.java?rev=1597163&r1=1597162&r2=1597163&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/AbstractIdentifiedType.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/AbstractIdentifiedType.java
[UTF-8] Fri May 23 19:18:59 2014
@@ -21,6 +21,7 @@ import java.util.Locale;
 import java.io.Serializable;
 import org.opengis.util.GenericName;
 import org.opengis.util.InternationalString;
+import org.opengis.feature.IdentifiedType;
 import org.apache.sis.internal.system.DefaultFactories;
 import org.apache.sis.util.resources.Errors;
 import org.apache.sis.util.iso.Types;
@@ -34,17 +35,12 @@ import java.util.Objects;
 /**
  * Identification and description information inherited by property types and feature types.
  *
- * <div class="warning"><b>Warning:</b>
- * This class is expected to implement a GeoAPI {@code IdentifiedType} interface in a future
version.
- * When such interface will be available, most references to {@code AbstractIdentifiedType}
in the API
- * will be replaced by references to the {@code IdentifiedType} interface.</div>
- *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.5
  * @version 0.5
  * @module
  */
-public class AbstractIdentifiedType implements Serializable {
+public class AbstractIdentifiedType implements IdentifiedType, Serializable {
     /**
      * For cross-version compatibility.
      */
@@ -198,6 +194,7 @@ public class AbstractIdentifiedType impl
      *
      * @return The type name.
      */
+    @Override
     public GenericName getName() {
         return name;
     }
@@ -207,6 +204,7 @@ public class AbstractIdentifiedType impl
      *
      * @return Concise definition of the element.
      */
+    @Override
     public InternationalString getDefinition() {
         return definition;
     }
@@ -217,6 +215,7 @@ public class AbstractIdentifiedType impl
      *
      * @return Natural language designator for the element.
      */
+    @Override
     public InternationalString getDesignation() {
         return designation;
     }
@@ -227,6 +226,7 @@ public class AbstractIdentifiedType impl
      *
      * @return Information beyond that required for concise definition of the element, or
{@code null} if none.
      */
+    @Override
     public InternationalString getDescription() {
         return description;
     }

Modified: sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/DefaultAssociationRole.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/DefaultAssociationRole.java?rev=1597163&r1=1597162&r2=1597163&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/DefaultAssociationRole.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/DefaultAssociationRole.java
[UTF-8] Fri May 23 19:18:59 2014
@@ -19,6 +19,7 @@ package org.apache.sis.feature;
 import java.util.Map;
 import org.opengis.util.GenericName;
 import org.opengis.util.InternationalString;
+import org.opengis.feature.IdentifiedType;
 import org.apache.sis.util.Debug;
 
 import static org.apache.sis.util.ArgumentChecks.*;
@@ -138,7 +139,7 @@ public class DefaultAssociationRole exte
         String p = titleProperty; // No synchronization - not a big deal if computed twice.
         if (p == null) {
             p = "";
-            for (final AbstractIdentifiedType type : valueType.getProperties(true)) {
+            for (final IdentifiedType type : valueType.getProperties(true)) {
                 if (type instanceof DefaultAttributeType<?>) {
                     final DefaultAttributeType<?> pt = (DefaultAttributeType<?>)
type;
                     if (pt.getMaximumOccurs() != 0 && CharSequence.class.isAssignableFrom(pt.getValueClass()))
{

Modified: sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/DefaultFeatureType.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/DefaultFeatureType.java?rev=1597163&r1=1597162&r2=1597163&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/DefaultFeatureType.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/DefaultFeatureType.java
[UTF-8] Fri May 23 19:18:59 2014
@@ -30,6 +30,7 @@ import java.io.IOException;
 import java.io.ObjectInputStream;
 import org.opengis.util.GenericName;
 import org.opengis.util.InternationalString;
+import org.opengis.feature.IdentifiedType;
 import org.apache.sis.util.ArgumentChecks;
 import org.apache.sis.util.resources.Errors;
 import org.apache.sis.util.collection.Containers;
@@ -209,7 +210,7 @@ public class DefaultFeatureType extends 
      *                       association role that carries characteristics of a feature type.
      */
     public DefaultFeatureType(final Map<String,?> identification, final boolean isAbstract,
-            final DefaultFeatureType[] superTypes, final AbstractIdentifiedType... properties)
+            final DefaultFeatureType[] superTypes, final IdentifiedType... properties)
     {
         super(identification);
         ArgumentChecks.ensureNonNull("properties", properties);
@@ -543,7 +544,7 @@ public class DefaultFeatureType extends 
      * @return Feature operation, attribute type and association role that carries characteristics
of this
      *         feature type (not including parent types).
      */
-    public Collection<AbstractIdentifiedType> getProperties(final boolean includeSuperTypes)
{
+    public Collection<IdentifiedType> getProperties(final boolean includeSuperTypes)
{
         // TODO: temporary cast to be removed after we upgraded GeoAPI.
         return (Collection) (includeSuperTypes ? allProperties : properties);
     }

Modified: sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/FeatureFormat.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/FeatureFormat.java?rev=1597163&r1=1597162&r2=1597163&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/FeatureFormat.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/FeatureFormat.java
[UTF-8] Fri May 23 19:18:59 2014
@@ -24,6 +24,7 @@ import java.text.FieldPosition;
 import java.text.ParsePosition;
 import java.text.ParseException;
 import java.util.concurrent.atomic.AtomicReference;
+import org.opengis.feature.IdentifiedType;
 import org.opengis.util.InternationalString;
 import org.opengis.util.GenericName;
 import org.apache.sis.io.TableAppender;
@@ -184,7 +185,7 @@ header: for (int i=0; ; i++) {
          * Done writing the header. Now write all property rows.
          * Rows without value will be skipped only if optional.
          */
-        for (final AbstractIdentifiedType propertyType : featureType.getProperties(true))
{
+        for (final IdentifiedType propertyType : featureType.getProperties(true)) {
             Object value;
             if (feature != null) {
                 value = feature.getPropertyValue(propertyType.getName().toString());

Modified: sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/Validator.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/Validator.java?rev=1597163&r1=1597162&r2=1597163&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/Validator.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/Validator.java
[UTF-8] Fri May 23 19:18:59 2014
@@ -20,6 +20,7 @@ import java.util.Collection;
 import java.util.Collections;
 import org.opengis.util.GenericName;
 import org.opengis.util.InternationalString;
+import org.opengis.feature.IdentifiedType;
 import org.opengis.metadata.Identifier;
 import org.opengis.metadata.maintenance.ScopeCode;
 import org.opengis.metadata.quality.EvaluationMethodType;
@@ -77,7 +78,7 @@ final class Validator {
      * @return The {@code report}, or a new report if {@code report} was null.
      */
     private AbstractElement addViolationReport(AbstractElement report,
-            final AbstractIdentifiedType type, final InternationalString explanation)
+            final IdentifiedType type, final InternationalString explanation)
     {
         if (report == null) {
             final GenericName name = type.getName();
@@ -158,7 +159,7 @@ final class Validator {
      *
      * @param report Where to add the result, or {@code null} if not yet created.
      */
-    private void verifyCardinality(final AbstractElement report, final AbstractIdentifiedType
type,
+    private void verifyCardinality(final AbstractElement report, final IdentifiedType type,
             final int minimumOccurs, final int maximumOccurs, final int count)
     {
         if (count < minimumOccurs) {

Modified: sis/branches/JDK8/core/sis-feature/src/test/java/org/apache/sis/feature/DefaultFeatureTypeTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-feature/src/test/java/org/apache/sis/feature/DefaultFeatureTypeTest.java?rev=1597163&r1=1597162&r2=1597163&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-feature/src/test/java/org/apache/sis/feature/DefaultFeatureTypeTest.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-feature/src/test/java/org/apache/sis/feature/DefaultFeatureTypeTest.java
[UTF-8] Fri May 23 19:18:59 2014
@@ -21,6 +21,7 @@ import java.util.HashMap;
 import java.util.Iterator;
 import java.util.Collection;
 import org.opengis.util.InternationalString;
+import org.opengis.feature.IdentifiedType;
 import org.apache.sis.test.DependsOnMethod;
 import org.apache.sis.test.DependsOn;
 import org.apache.sis.test.TestCase;
@@ -192,7 +193,7 @@ public final strictfp class DefaultFeatu
             final String... expected)
     {
         int index = 0;
-        for (final AbstractIdentifiedType property : feature.getProperties(includeSuperTypes))
{
+        for (final IdentifiedType property : feature.getProperties(includeSuperTypes)) {
             assertTrue("Found more properties than expected.", index < expected.length);
             final String name = expected[index++];
             assertNotNull(name, property);
@@ -258,8 +259,8 @@ public final strictfp class DefaultFeatu
                 false, null, city, population, festival);
 
         assertUnmodifiable(complex);
-        final Collection<AbstractIdentifiedType> properties = complex.getProperties(false);
-        final Iterator<AbstractIdentifiedType> it = properties.iterator();
+        final Collection<IdentifiedType> properties = complex.getProperties(false);
+        final Iterator<IdentifiedType> it = properties.iterator();
 
         assertEquals("name",            "Festival",                     complex.getName().toString());
         assertTrue  ("superTypes",                                      complex.getSuperTypes().isEmpty());



Mime
View raw message