sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1640393 - in /sis/branches/JDK8/core: sis-feature/src/main/java/org/apache/sis/feature/ sis-utility/src/main/java/org/apache/sis/internal/simple/
Date Tue, 18 Nov 2014 17:24:45 GMT
Author: desruisseaux
Date: Tue Nov 18 17:24:44 2014
New Revision: 1640393

URL: http://svn.apache.org/r1640393
Log:
Feature: 'newInstance()' method added in GeoAPI.

Modified:
    sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/AbstractFeature.java
    sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/CharacteristicMap.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/DefaultAttributeType.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/NamedFeatureType.java
    sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/simple/SimpleAttributeType.java

Modified: sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/AbstractFeature.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/AbstractFeature.java?rev=1640393&r1=1640392&r2=1640393&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/AbstractFeature.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/AbstractFeature.java
[UTF-8] Tue Nov 18 17:24:44 2014
@@ -192,9 +192,9 @@ public abstract class AbstractFeature im
     final Property createProperty(final String name) throws IllegalArgumentException {
         final PropertyType pt = type.getProperty(name);
         if (pt instanceof AttributeType<?>) {
-            return AbstractAttribute.create((AttributeType<?>) pt);
+            return ((AttributeType<?>) pt).newInstance();
         } else if (pt instanceof FeatureAssociationRole) {
-            return AbstractAssociation.create((FeatureAssociationRole) pt);
+            return ((FeatureAssociationRole) pt).newInstance();
         } else {
             throw unsupportedPropertyType(pt.getName());
         }

Modified: sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/CharacteristicMap.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/CharacteristicMap.java?rev=1640393&r1=1640392&r2=1640393&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/CharacteristicMap.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/CharacteristicMap.java
[UTF-8] Tue Nov 18 17:24:44 2014
@@ -230,7 +230,7 @@ final class CharacteristicMap extends Ab
             characterizedBy = new Attribute<?>[types.characterizedBy.length];
         }
         if (characterizedBy[index] == null) {
-            characterizedBy[index] = AbstractAttribute.create(types.characterizedBy[index]);
+            characterizedBy[index] = types.characterizedBy[index].newInstance();
             return true;
         }
         return false;

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=1640393&r1=1640392&r2=1640393&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] Tue Nov 18 17:24:44 2014
@@ -393,6 +393,7 @@ public class DefaultAssociationRole exte
      *
      * @see AbstractAssociation#create(FeatureAssociationRole)
      */
+    @Override
     public FeatureAssociation newInstance() {
         return AbstractAssociation.create(this);
     }

Modified: sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/DefaultAttributeType.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/DefaultAttributeType.java?rev=1640393&r1=1640392&r2=1640393&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/DefaultAttributeType.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/DefaultAttributeType.java
[UTF-8] Tue Nov 18 17:24:44 2014
@@ -306,6 +306,7 @@ public class DefaultAttributeType<V> ext
      *
      * @see AbstractAttribute#create(AttributeType)
      */
+    @Override
     public Attribute<V> newInstance() {
         return AbstractAttribute.create(this);
     }

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=1640393&r1=1640392&r2=1640393&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] Tue Nov 18 17:24:44 2014
@@ -682,6 +682,7 @@ public class DefaultFeatureType extends 
      * @return A new feature instance.
      * @throws IllegalStateException if this feature type {@linkplain #isAbstract() is abstract}.
      */
+    @Override
     public Feature newInstance() throws IllegalStateException {
         if (isAbstract) {
             throw new IllegalStateException(Errors.format(Errors.Keys.AbstractType_1, getName()));

Modified: sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/NamedFeatureType.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/NamedFeatureType.java?rev=1640393&r1=1640392&r2=1640393&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/NamedFeatureType.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/NamedFeatureType.java
[UTF-8] Tue Nov 18 17:24:44 2014
@@ -20,6 +20,7 @@ import java.util.Set;
 import java.util.Collection;
 import java.util.Collections;
 import java.io.Serializable;
+import org.opengis.feature.Feature;
 import org.opengis.feature.FeatureType;
 import org.opengis.feature.PropertyType;
 import org.opengis.util.GenericName;
@@ -117,6 +118,14 @@ final class NamedFeatureType implements 
     }
 
     /**
+     * Unsupported operation, since the feature has not yet been resolved.
+     */
+    @Override
+    public Feature newInstance() throws IllegalStateException {
+        throw new IllegalStateException(Errors.format(Errors.Keys.UnresolvedFeatureName_1,
getName()));
+    }
+
+    /**
      * Returns a string representation of this feature type.
      */
     @Override

Modified: sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/simple/SimpleAttributeType.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/simple/SimpleAttributeType.java?rev=1640393&r1=1640392&r2=1640393&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/simple/SimpleAttributeType.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/simple/SimpleAttributeType.java
[UTF-8] Tue Nov 18 17:24:44 2014
@@ -18,6 +18,7 @@ package org.apache.sis.internal.simple;
 
 import java.io.Serializable;
 import org.opengis.util.Type;
+import org.opengis.feature.Attribute;
 import org.opengis.feature.AttributeType;
 import org.opengis.util.GenericName;
 import org.opengis.util.InternationalString;
@@ -154,6 +155,14 @@ public final class SimpleAttributeType<V
     }
 
     /**
+     * Unsupported operation.
+     */
+    @Override
+    public Attribute<V> newInstance() {
+        throw new UnsupportedOperationException();
+    }
+
+    /**
      * Returns a hash code value for this type.
      *
      * @return A hash code value.



Mime
View raw message