sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1599530 - in /sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature: AbstractIdentifiedType.java DefaultAssociationRole.java DefaultAttributeType.java DefaultFeatureType.java DefaultOperation.java FieldType.java
Date Tue, 03 Jun 2014 13:07:27 GMT
Author: desruisseaux
Date: Tue Jun  3 13:07:26 2014
New Revision: 1599530

URL: http://svn.apache.org/r1599530
Log:
Rollback the restriction of FeatureType name to TypeName. While FeatureAssociationRole.valueType
in ISO 19109
was suggesting that FeatureType names were instances of TypeName, the evidence is not strong
enough. So we keep
GenericName for now as a conservative approach.

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/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/DefaultOperation.java
    sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/FieldType.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=1599530&r1=1599529&r2=1599530&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] Tue Jun  3 13:07:26 2014
@@ -19,8 +19,7 @@ package org.apache.sis.feature;
 import java.util.Map;
 import java.util.Locale;
 import java.io.Serializable;
-import org.opengis.util.TypeName;
-import org.opengis.util.LocalName;
+import org.opengis.util.NameFactory;
 import org.opengis.util.GenericName;
 import org.opengis.util.InternationalString;
 import org.apache.sis.internal.system.DefaultFactories;
@@ -164,10 +163,9 @@ public class AbstractIdentifiedType impl
      * since localizations are applied by the {@link InternationalString#toString(Locale)}
method.</p>
      *
      * @param  identification The name and other information to be given to this identified
type.
-     * @param  nameType The type of name, either {@code GenericName.class} or {@code TypeName.class}.
      * @throws IllegalArgumentException if a property has an invalid value.
      */
-    protected AbstractIdentifiedType(final Map<String,?> identification, final Class<?
extends GenericName> nameType)
+    protected AbstractIdentifiedType(final Map<String,?> identification)
             throws IllegalArgumentException
     {
         ensureNonNull("identification", identification);
@@ -176,12 +174,8 @@ public class AbstractIdentifiedType impl
             throw new IllegalArgumentException(Errors.getResources(identification)
                     .getString(Errors.Keys.MissingValueForProperty_1, NAME_KEY));
         } else if (value instanceof String) {
-            if (nameType == TypeName.class) {
-                name = DefaultFactories.NAMES.createTypeName(null, (String) value);
-            } else {
-                name = DefaultFactories.NAMES.createLocalName(null, (String) value);
-            }
-        } else if (nameType.isInstance(value)) {
+            name = createName(DefaultFactories.NAMES, (String) value);
+        } else if (value instanceof GenericName) {
             name = (GenericName) value;
         } else {
             throw new IllegalArgumentException(Errors.getResources(identification).getString(
@@ -193,6 +187,14 @@ public class AbstractIdentifiedType impl
     }
 
     /**
+     * Creates a name from the given string. This method is invoked at construction time,
+     * so it should not use any field in this {@code AbtractIdentifiedObject} instance.
+     */
+    GenericName createName(final NameFactory factory, final String value) {
+        return factory.createLocalName(null, value);
+    }
+
+    /**
      * Returns the name of this type.
      * The namespace can be either explicit
      * ({@linkplain org.apache.sis.util.iso.DefaultScopedName scoped name}) or implicit

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=1599530&r1=1599529&r2=1599530&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 Jun  3 13:07:26 2014
@@ -78,7 +78,7 @@ public class DefaultAssociationRole exte
 
     /**
      * Constructs an association role from the given properties. The properties map is given
unchanged to
-     * the {@linkplain AbstractIdentifiedType#AbstractIdentifiedType(Map, Class) super-class
constructor}.
+     * the {@linkplain AbstractIdentifiedType#AbstractIdentifiedType(Map) super-class constructor}.
      * The following table is a reminder of main (not all) recognized map entries:
      *
      * <table class="sis">

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=1599530&r1=1599529&r2=1599530&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 Jun  3 13:07:26 2014
@@ -93,7 +93,7 @@ public class DefaultAttributeType<V> ext
 
     /**
      * Constructs an attribute type from the given properties. The identification map is
given unchanged to
-     * the {@linkplain AbstractIdentifiedType#AbstractIdentifiedType(Map, Class) super-class
constructor}.
+     * the {@linkplain AbstractIdentifiedType#AbstractIdentifiedType(Map) super-class constructor}.
      * The following table is a reminder of main (not all) recognized map entries:
      *
      * <table class="sis">

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=1599530&r1=1599529&r2=1599530&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 Jun  3 13:07:26 2014
@@ -27,7 +27,7 @@ import java.util.Collection;
 import java.util.Collections;
 import java.io.IOException;
 import java.io.ObjectInputStream;
-import org.opengis.util.TypeName;
+import org.opengis.util.NameFactory;
 import org.opengis.util.GenericName;
 import org.opengis.util.InternationalString;
 import org.apache.sis.util.ArgumentChecks;
@@ -130,7 +130,7 @@ public class DefaultFeatureType extends 
      *
      * @see #isAssignableFrom(FeatureType)
      */
-    private transient Set<TypeName> assignableTo;
+    private transient Set<GenericName> assignableTo;
 
     /**
      * Any feature operation, any feature attribute type and any feature association role
@@ -167,7 +167,7 @@ public class DefaultFeatureType extends 
 
     /**
      * Constructs a feature type from the given properties. The identification map is given
unchanged to
-     * the {@linkplain AbstractIdentifiedType#AbstractIdentifiedType(Map, Class) super-class
constructor}.
+     * the {@linkplain AbstractIdentifiedType#AbstractIdentifiedType(Map) super-class constructor}.
      * The following table is a reminder of main (not all) recognized map entries:
      *
      * <table class="sis">
@@ -179,7 +179,7 @@ public class DefaultFeatureType extends 
      *   </tr>
      *   <tr>
      *     <td>{@value org.apache.sis.feature.AbstractIdentifiedType#NAME_KEY}</td>
-     *     <td>{@link TypeName} or {@link String}</td>
+     *     <td>{@link GenericName} or {@link String}</td>
      *     <td>{@link #getName()}</td>
      *   </tr>
      *   <tr>
@@ -208,7 +208,7 @@ public class DefaultFeatureType extends 
     public DefaultFeatureType(final Map<String,?> identification, final boolean isAbstract,
             final FeatureType[] superTypes, final PropertyType... properties)
     {
-        super(identification, TypeName.class);
+        super(identification);
         ArgumentChecks.ensureNonNull("properties", properties);
         this.isAbstract = isAbstract;
         this.superTypes = (superTypes == null) ? Collections.<FeatureType>emptySet()
:
@@ -222,6 +222,15 @@ public class DefaultFeatureType extends 
     }
 
     /**
+     * Creates a name from the given string. This method is invoked at construction time,
+     * so it should not use any field in this {@code AbtractIdentifiedObject} instance.
+     */
+    @Override
+    GenericName createName(final NameFactory factory, final String value) {
+        return factory.createTypeName(null, value);
+    }
+
+    /**
      * Invoked on deserialization for restoring the {@link #byName} and other transient fields.
      *
      * @param  in The input stream from which to deserialize a feature type.
@@ -330,7 +339,7 @@ public class DefaultFeatureType extends 
             final PropertyType previous = byName.put(name, property);
             if (previous != null) {
                 if (!isAssignableIgnoreName(previous, property)) {
-                    final TypeName owner = ownerOf(this, previous);
+                    final GenericName owner = ownerOf(this, previous);
                     throw new IllegalArgumentException(Errors.format(Errors.Keys.PropertyAlreadyExists_2,
                             (owner != null) ? owner : "?", name));
                 }
@@ -343,12 +352,12 @@ public class DefaultFeatureType extends 
      * This method is for information purpose when producing an error message - its implementation
does
      * not need to be efficient.
      */
-    private static TypeName ownerOf(final FeatureType type, final PropertyType property)
{
+    private static GenericName ownerOf(final FeatureType type, final PropertyType property)
{
         if (type.getProperties(false).contains(property)) {
             return type.getName();
         }
         for (final FeatureType superType : type.getSuperTypes()) {
-            final TypeName owner = ownerOf(superType, property);
+            final GenericName owner = ownerOf(superType, property);
             if (owner != null) {
                 return owner;
             }
@@ -386,16 +395,6 @@ public class DefaultFeatureType extends 
 
 
     /**
-     * Returns the name of this feature type.
-     *
-     * @return The name of this feature type.
-     */
-    @Override
-    public TypeName getName() {
-        return (TypeName) super.getName();
-    }
-
-    /**
      * Returns {@code true} if the feature type acts as an abstract super-type.
      * Abstract types can not be {@linkplain #newInstance() instantiated}.
      *

Modified: sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/DefaultOperation.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/DefaultOperation.java?rev=1599530&r1=1599529&r2=1599530&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/DefaultOperation.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/DefaultOperation.java
[UTF-8] Tue Jun  3 13:07:26 2014
@@ -68,7 +68,7 @@ public class DefaultOperation extends Ab
 
     /**
      * Constructs an operation from the given properties. The identification map is given
unchanged to
-     * the {@linkplain AbstractIdentifiedType#AbstractIdentifiedType(Map, Class) super-class
constructor}.
+     * the {@linkplain AbstractIdentifiedType#AbstractIdentifiedType(Map) super-class constructor}.
      *
      * @param identification The name and other information to be given to this operation.
      * @param parameters     A description of the input parameters.
@@ -77,7 +77,7 @@ public class DefaultOperation extends Ab
     public DefaultOperation(final Map<String,?> identification,
             final ParameterDescriptorGroup parameters, final IdentifiedType result)
     {
-        super(identification, GenericName.class);
+        super(identification);
         ArgumentChecks.ensureNonNull("parameters", parameters);
         this.parameters = parameters;
         this.result     = result;

Modified: sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/FieldType.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/FieldType.java?rev=1599530&r1=1599529&r2=1599530&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/FieldType.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/FieldType.java
[UTF-8] Tue Jun  3 13:07:26 2014
@@ -58,7 +58,7 @@ abstract class FieldType extends Abstrac
 
     /**
      * Constructs a field type from the given properties. The identification map is given
unchanged to
-     * the {@linkplain AbstractIdentifiedType#AbstractIdentifiedType(Map, Class) super-class
constructor}.
+     * the {@linkplain AbstractIdentifiedType#AbstractIdentifiedType(Map) super-class constructor}.
      *
      * @param identification The name and other information to be given to this field type.
      * @param minimumOccurs  The minimum number of occurrences of the property within its
containing entity.
@@ -66,7 +66,7 @@ abstract class FieldType extends Abstrac
      *                       or {@link Integer#MAX_VALUE} if there is no restriction.
      */
     FieldType(final Map<String,?> identification, final int minimumOccurs, final int
maximumOccurs) {
-        super(identification, GenericName.class);
+        super(identification);
         if (minimumOccurs < 0 || maximumOccurs < minimumOccurs) {
             throw new IllegalArgumentException(Errors.format(
                     Errors.Keys.IllegalRange_2, minimumOccurs, maximumOccurs));



Mime
View raw message