sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1599465 - /sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/
Date Tue, 03 Jun 2014 10:14:08 GMT
Author: desruisseaux
Date: Tue Jun  3 10:14:07 2014
New Revision: 1599465

URL: http://svn.apache.org/r1599465
Log:
Restrict the FeatureType name from GenericName to TypeName.

Modified:
    sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/AbstractAssociation.java
    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/AbstractAssociation.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/AbstractAssociation.java?rev=1599465&r1=1599464&r2=1599465&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/AbstractAssociation.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/AbstractAssociation.java
[UTF-8] Tue Jun  3 10:14:07 2014
@@ -33,7 +33,7 @@ import org.opengis.feature.FeatureAssoci
 
 
 /**
- * Indicates the role played by the association between two features.
+ * An instance of an {@linkplain DefaultAssociationRole feature association role} containing
the associated feature.
  *
  * {@section Limitations}
  * <ul>

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=1599465&r1=1599464&r2=1599465&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 10:14:07 2014
@@ -19,6 +19,8 @@ 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.GenericName;
 import org.opengis.util.InternationalString;
 import org.apache.sis.internal.system.DefaultFactories;
@@ -162,17 +164,24 @@ 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) throws IllegalArgumentException
{
+    protected AbstractIdentifiedType(final Map<String,?> identification, final Class<?
extends GenericName> nameType)
+            throws IllegalArgumentException
+    {
         ensureNonNull("identification", identification);
         Object value = identification.get(NAME_KEY);
         if (value == null) {
             throw new IllegalArgumentException(Errors.getResources(identification)
                     .getString(Errors.Keys.MissingValueForProperty_1, NAME_KEY));
         } else if (value instanceof String) {
-            name = DefaultFactories.NAMES.createLocalName(null, (String) value);
-        } else if (value instanceof GenericName) {
+            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 = (GenericName) value;
         } else {
             throw new IllegalArgumentException(Errors.getResources(identification).getString(

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=1599465&r1=1599464&r2=1599465&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 10:14:07 2014
@@ -77,8 +77,8 @@ public class DefaultAssociationRole exte
     private volatile transient String titleProperty;
 
     /**
-     * Constructs an association role from the given properties. The properties map is given
unchanged
-     * to the {@linkplain AbstractIdentifiedType#AbstractIdentifiedType(Map) super-class
constructor}.
+     * 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 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=1599465&r1=1599464&r2=1599465&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 10:14:07 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) super-class constructor}.
+     * the {@linkplain AbstractIdentifiedType#AbstractIdentifiedType(Map, Class) 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=1599465&r1=1599464&r2=1599465&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 10:14:07 2014
@@ -27,6 +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.GenericName;
 import org.opengis.util.InternationalString;
 import org.apache.sis.util.ArgumentChecks;
@@ -129,7 +130,7 @@ public class DefaultFeatureType extends 
      *
      * @see #isAssignableFrom(FeatureType)
      */
-    private transient Set<GenericName> assignableTo;
+    private transient Set<TypeName> assignableTo;
 
     /**
      * Any feature operation, any feature attribute type and any feature association role
@@ -166,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) super-class constructor}.
+     * the {@linkplain AbstractIdentifiedType#AbstractIdentifiedType(Map, Class) super-class
constructor}.
      * The following table is a reminder of main (not all) recognized map entries:
      *
      * <table class="sis">
@@ -178,7 +179,7 @@ public class DefaultFeatureType extends 
      *   </tr>
      *   <tr>
      *     <td>{@value org.apache.sis.feature.AbstractIdentifiedType#NAME_KEY}</td>
-     *     <td>{@link GenericName} or {@link String}</td>
+     *     <td>{@link TypeName} or {@link String}</td>
      *     <td>{@link #getName()}</td>
      *   </tr>
      *   <tr>
@@ -207,7 +208,7 @@ public class DefaultFeatureType extends 
     public DefaultFeatureType(final Map<String,?> identification, final boolean isAbstract,
             final FeatureType[] superTypes, final PropertyType... properties)
     {
-        super(identification);
+        super(identification, TypeName.class);
         ArgumentChecks.ensureNonNull("properties", properties);
         this.isAbstract = isAbstract;
         this.superTypes = (superTypes == null) ? Collections.<FeatureType>emptySet()
:
@@ -329,7 +330,7 @@ public class DefaultFeatureType extends 
             final PropertyType previous = byName.put(name, property);
             if (previous != null) {
                 if (!isAssignableIgnoreName(previous, property)) {
-                    final GenericName owner = ownerOf(this, previous);
+                    final TypeName owner = ownerOf(this, previous);
                     throw new IllegalArgumentException(Errors.format(Errors.Keys.PropertyAlreadyExists_2,
                             (owner != null) ? owner : "?", name));
                 }
@@ -342,12 +343,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 GenericName ownerOf(final FeatureType type, final PropertyType property)
{
+    private static TypeName ownerOf(final FeatureType type, final PropertyType property)
{
         if (type.getProperties(false).contains(property)) {
             return type.getName();
         }
         for (final FeatureType superType : type.getSuperTypes()) {
-            final GenericName owner = ownerOf(superType, property);
+            final TypeName owner = ownerOf(superType, property);
             if (owner != null) {
                 return owner;
             }
@@ -385,6 +386,16 @@ 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=1599465&r1=1599464&r2=1599465&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 10:14:07 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) super-class constructor}.
+     * the {@linkplain AbstractIdentifiedType#AbstractIdentifiedType(Map, Class) 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);
+        super(identification, GenericName.class);
         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=1599465&r1=1599464&r2=1599465&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 10:14:07 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) super-class constructor}.
+     * the {@linkplain AbstractIdentifiedType#AbstractIdentifiedType(Map, Class) 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);
+        super(identification, GenericName.class);
         if (minimumOccurs < 0 || maximumOccurs < minimumOccurs) {
             throw new IllegalArgumentException(Errors.format(
                     Errors.Keys.IllegalRange_2, minimumOccurs, maximumOccurs));



Mime
View raw message