sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1751436 - in /sis/branches/JDK8: core/sis-feature/src/main/java/org/apache/sis/feature/ core/sis-feature/src/main/java/org/apache/sis/internal/feature/ core/sis-feature/src/test/java/org/apache/sis/feature/ core/sis-feature/src/test/java/o...
Date Tue, 05 Jul 2016 10:33:21 GMT
Author: desruisseaux
Date: Tue Jul  5 10:33:20 2016
New Revision: 1751436

URL: http://svn.apache.org/viewvc?rev=1751436&view=rev
Log:
Rename AttributeConvention static final constants to match better their value.

Modified:
    sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/EnvelopeOperation.java
    sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/FeatureOperations.java
    sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/internal/feature/AttributeConvention.java
    sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/internal/feature/FeatureTypeBuilder.java
    sis/branches/JDK8/core/sis-feature/src/test/java/org/apache/sis/feature/EnvelopeOperationTest.java
    sis/branches/JDK8/core/sis-feature/src/test/java/org/apache/sis/internal/feature/FeatureTypeBuilderTest.java
    sis/branches/JDK8/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/gpx/GPXConstants.java

Modified: sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/EnvelopeOperation.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/EnvelopeOperation.java?rev=1751436&r1=1751435&r2=1751436&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/EnvelopeOperation.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/EnvelopeOperation.java
[UTF-8] Tue Jul  5 10:33:20 2016
@@ -142,7 +142,7 @@ final class EnvelopeOperation extends Ab
                 final GenericName name = property.getName();
                 final String attributeName = (property instanceof LinkOperation)
                                              ? ((LinkOperation) property).referentName :
name.toString();
-                final boolean isDefault = AttributeConvention.DEFAULT_GEOMETRY_PROPERTY.equals(name.tip());
+                final boolean isDefault = AttributeConvention.GEOMETRY_PROPERTY.equals(name.tip());
                 if (isDefault) {
                     defaultGeometry = attributeName;
                 }

Modified: sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/FeatureOperations.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/FeatureOperations.java?rev=1751436&r1=1751435&r2=1751436&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/FeatureOperations.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/FeatureOperations.java
[UTF-8] Tue Jul  5 10:33:20 2016
@@ -131,7 +131,7 @@ public final class FeatureOperations ext
      * For example features of type <b>Country</b> may have identifiers named
“ISO country code”
      * while features of type <b>Car</b> may have identifiers named “license
plate number”.
      * In order to simplify identifier usages regardless of their name,
-     * an application could choose to add in all features a virtual property named {@code
"@id"}
+     * an application could choose to add in all features a virtual property named {@code
"identifier"}
      * which links to whatever property is used as an identifier in an arbitrary feature.
      * So the definition of the <b>Car</b> feature could contain the following
code:
      *
@@ -139,7 +139,7 @@ public final class FeatureOperations ext
      *   AttributeType licensePlateNumber = ...;            // Attribute creation omitted
for brevity
      *   FeatureType car = new DefaultFeatureType(...,      // Arguments omitted for brevity
      *           licensePlateNumber, model, owner,
-     *           FeatureOperations.link(singletonMap(NAME_KEY, "@id"), licensePlateNumber);
+     *           FeatureOperations.link(singletonMap(NAME_KEY, "identifier"), licensePlateNumber);
      * }
      * </div>
      *

Modified: sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/internal/feature/AttributeConvention.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/internal/feature/AttributeConvention.java?rev=1751436&r1=1751435&r2=1751436&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/internal/feature/AttributeConvention.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/internal/feature/AttributeConvention.java
[UTF-8] Tue Jul  5 10:33:20 2016
@@ -41,10 +41,10 @@ import org.opengis.feature.Property;
  * appropriate "real" property in the feature.
  *
  * <div class="note"><b>Example:</b>
- * one of the most frequently used synthetic property is {@code "@id"}, which contains a
unique
+ * one of the most frequently used synthetic property is {@code "@identifier"}, which contains
a unique
  * identifier (or primary key) for the feature. This property is usually (but not necessarily)
  * a {@linkplain org.apache.sis.feature.FeatureOperations#link link to an existing attribute}.
- * By using the {@code "@id"} alias, users do not need to know the name of the "real" attribute.
+ * By using the {@code "@identifier"} alias, users do not need to know the name of the "real"
attribute.
  * </div>
  *
  * This class defines names for two kinds of usage:
@@ -61,7 +61,7 @@ import org.opengis.feature.Property;
  * but we may refactor this class in future SIS versions if there is a need to support different
conventions.
  *
  * <p>In order to reduce the risk of name collision with properties in user-defined
features
- * (e.g. the user may already have an attribute named {@code "id"} for his own purpose),
+ * (e.g. the user may already have an attribute named {@code "identifier"} for his own purpose),
  * all names defined in this class begin with the {@code "@"} character.</p>
  *
  * @author  Johann Sorel (Geomatys)
@@ -90,7 +90,7 @@ public final class AttributeConvention e
      * <p>The {@linkplain org.apache.sis.feature.DefaultAttributeType#getValueClass()
value class} is usually
      * {@link String}, {@link Integer}, {@link java.util.UUID} or other types commonly used
as identifiers.</p>
      */
-    public static final LocalName ID_PROPERTY;
+    public static final LocalName IDENTIFIER_PROPERTY;
 
     /**
      * Conventional name for a property containing the geometric object to use by default.
@@ -107,11 +107,11 @@ public final class AttributeConvention e
      *
      * @see #isGeometryAttribute(IdentifiedType)
      */
-    public static final LocalName DEFAULT_GEOMETRY_PROPERTY;
+    public static final LocalName GEOMETRY_PROPERTY;
 
     /**
      * Conventional name for fetching the envelope encompassing all geometries in a feature.
Most {@code FeatureType}s
-     * have at most one geometry, which is also the {@linkplain #DEFAULT_GEOMETRY_PROPERTY
default geometry}.
+     * have at most one geometry, which is also the {@link #GEOMETRY_PROPERTY default geometry}.
      * But if several geometries exist, then the value for this synthetic property is the
union of all geometries.
      *
      * <p>Properties of this name are usually
@@ -126,10 +126,10 @@ public final class AttributeConvention e
      * Conventional name for fetching the Coordinate Reference System (CRS) of a geometry
or a coverage.
      * This characteristic is typically an entry in the map returned by a call to the
      * {@link org.apache.sis.feature.DefaultAttributeType#characteristics()} method
-     * on the attribute referenced by {@link #DEFAULT_GEOMETRY_PROPERTY}.
+     * on the attribute referenced by {@link #GEOMETRY_PROPERTY}.
      *
      * <p>While it is technically possible to have different CRS for different feature
instances,
-     * in most cases the CRS is the same for all geometries found in {@code DEFAULT_GEOMETRY_PROPERTY}.
+     * in most cases the CRS is the same for all geometries found in {@code GEOMETRY_PROPERTY}.
      * In such cases, the CRS can be specified only once as the
      * {@linkplain org.apache.sis.feature.DefaultAttributeType#getDefaultValue() default
value}
      * of this {@code CRS_CHARACTERISTIC}.</p>
@@ -168,8 +168,8 @@ public final class AttributeConvention e
         final NameFactory factory = DefaultFactories.forBuildin(NameFactory.class);
         NAMESPACE                     = factory.createGenericName(null, "Apache", Constants.SIS);
         NameSpace ns                  = factory.createNameSpace(NAMESPACE, null);
-        ID_PROPERTY                   = factory.createLocalName(ns, "@identifier");
-        DEFAULT_GEOMETRY_PROPERTY     = factory.createLocalName(ns, "@geometry");
+        IDENTIFIER_PROPERTY           = factory.createLocalName(ns, "@identifier");
+        GEOMETRY_PROPERTY             = factory.createLocalName(ns, "@geometry");
         ENVELOPE_PROPERTY             = factory.createLocalName(ns, "@envelope");
         CRS_CHARACTERISTIC            = factory.createLocalName(ns, "@crs");
         MAXIMAL_LENGTH_CHARACTERISTIC = factory.createLocalName(ns, "@maximalLength");
@@ -223,7 +223,7 @@ public final class AttributeConvention e
      * @return {@code true} if the given type is (directly or indirectly) an attribute type
      *         for one of the recognized geometry types.
      *
-     * @see #DEFAULT_GEOMETRY_PROPERTY
+     * @see #GEOMETRY_PROPERTY
      */
     public static boolean isGeometryAttribute(IdentifiedType type) {
         while (type instanceof Operation) {

Modified: sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/internal/feature/FeatureTypeBuilder.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/internal/feature/FeatureTypeBuilder.java?rev=1751436&r1=1751435&r2=1751436&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/internal/feature/FeatureTypeBuilder.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/internal/feature/FeatureTypeBuilder.java
[UTF-8] Tue Jul  5 10:33:20 2016
@@ -105,27 +105,27 @@ public class FeatureTypeBuilder extends
 
     /**
      * If {@link #idAttributes} is non-null, an optional prefix or suffix to insert before
-     * or after the {@linkplain FeatureOperations#compound compound key} named {@code "@id"}.
+     * or after the {@linkplain FeatureOperations#compound compound key} named {@code "@identifier"}.
      */
     private String idPrefix, idSuffix;
 
     /**
      * If {@link #idAttributes} is non-null and contains more than one value, the separator
to insert between
-     * each single component in a {@linkplain FeatureOperations#compound compound key} named
{@code "@id"}.
+     * each single component in a {@linkplain FeatureOperations#compound compound key} named
{@code "@identifier"}.
      */
     private String idDelimiter;
 
     /**
-     * The attributes to use in a {@linkplain FeatureOperations#compound compound key} named
{@code "@id"},
+     * The attributes to use in a {@linkplain FeatureOperations#compound compound key} named
{@code "@identifier"},
      * or {@code null} if none. If this array contains only one property and {@link #idPrefix}
is null,
-     * then {@code "@id"} will be a {@linkplain FeatureOperations#link link} to {@code idAttributes[0]}.
+     * then {@code "@identifier"} will be a {@linkplain FeatureOperations#link link} to {@code
idAttributes[0]}.
      */
     private final List<Property<?>> idAttributes;
 
     /**
      * The default geometry attribute, or {@code null} if none.
      *
-     * @see AttributeConvention#DEFAULT_GEOMETRY_PROPERTY
+     * @see AttributeConvention#GEOMETRY_PROPERTY
      */
     private Property<?> defaultGeometry;
 
@@ -261,11 +261,11 @@ public class FeatureTypeBuilder extends
      * <ul>
      *   <li>If this method is never invoked, no attribute is marked as feature identifier.</li>
      *   <li>If this method is invoked exactly once, then a new attribute is created
in the same way than
-     *       {@link #addAttribute(Class)} and a synthetic attribute named {@code "@id"} will
be created as
-     *       a {@linkplain FeatureOperations#link link} to the new attribute.</li>
+     *       {@link #addAttribute(Class)} and a synthetic attribute named {@code "@identifier"}
+     *       will be created as a {@linkplain FeatureOperations#link link} to the new attribute.</li>
      *   <li>If this method is invoked more than once, then new attributes are created
in the same way than
-     *       {@link #addAttribute(Class)} and a synthetic attribute named {@code "@id"} will
be created as
-     *       a {@linkplain FeatureOperations#compound compound key} made of all identifiers.</li>
+     *       {@link #addAttribute(Class)} and a synthetic attribute named {@code "@identifier"}
will be created
+     *       as a {@linkplain FeatureOperations#compound compound key} made of all identifiers.</li>
      * </ul>
      *
      * Callers shall invoke at least one of the {@code Property.setName(…)} methods on
the returned instance.
@@ -301,7 +301,7 @@ public class FeatureTypeBuilder extends
         }
         if (defaultGeometry != null) {
             throw new IllegalStateException(errors().getString(Errors.Keys.PropertyAlreadyExists_2,
-                    getDisplayName(), AttributeConvention.DEFAULT_GEOMETRY_PROPERTY));
+                    getDisplayName(), AttributeConvention.GEOMETRY_PROPERTY));
         }
         final Property<V> property = new Property<>(valueClass);
         defaultGeometry = property;
@@ -691,7 +691,7 @@ public class FeatureTypeBuilder extends
             numSynthetic = 0;
         } else {
             identifierTypes = new PropertyType[idAttributes.size()];
-            numSynthetic = 1;                               // Reserve one slot for the synthetic
property "@id".
+            numSynthetic = 1;                               // Reserve one slot for the synthetic
property "@identifier".
         }
         if (defaultGeometry != null) {
             numSynthetic += 2;                              // One slot for "@defaultGeometry"
and one for "@envelope".
@@ -712,19 +712,19 @@ public class FeatureTypeBuilder extends
              */
             if (builder == defaultGeometry) {
                 final PropertyType geom;
-                if (AttributeConvention.DEFAULT_GEOMETRY_PROPERTY.equals(instance.getName()))
{
+                if (AttributeConvention.GEOMETRY_PROPERTY.equals(instance.getName())) {
                     propertyTypes = ArraysExt.remove(propertyTypes, j--, 1);
                     geom = instance;
                 } else {
-                    geom = FeatureOperations.link(name(AttributeConvention.DEFAULT_GEOMETRY_PROPERTY),
instance);
+                    geom = FeatureOperations.link(name(AttributeConvention.GEOMETRY_PROPERTY),
instance);
                 }
                 propertyTypes[numSynthetic - 1] = geom;
             }
         }
         /*
-         * Create the "envelope" operation only after we created all other properties, except
"@id" which is not needed
-         * for envelope. It is okay if the 'propertyTypes' array still contains null elements
like the "@id" one, since
-         * FeatureOperations.envelope(…) constructor will ignore any property which is
not for a value.
+         * Create the "envelope" operation only after we created all other properties, except
"@identifier" which is not
+         * needed for envelope. It is okay if the 'propertyTypes' array still contains null
elements like "@identifier",
+         * since FeatureOperations.envelope(…) constructor will ignore any property which
is not for a value.
          */
         if (defaultGeometry != null) try {
             propertyTypes[numSynthetic - 2] = FeatureOperations.envelope(name(AttributeConvention.ENVELOPE_PROPERTY),
null, propertyTypes);
@@ -732,7 +732,7 @@ public class FeatureTypeBuilder extends
             throw new IllegalStateException(e);
         }
         if (identifierTypes != null) {
-            propertyTypes[0] = FeatureOperations.compound(name(AttributeConvention.ID_PROPERTY),
idDelimiter, idPrefix, idSuffix, identifierTypes);
+            propertyTypes[0] = FeatureOperations.compound(name(AttributeConvention.IDENTIFIER_PROPERTY),
idDelimiter, idPrefix, idSuffix, identifierTypes);
         }
         return new DefaultFeatureType(identification, isAbstract, superTypes.toArray(new
FeatureType[superTypes.size()]), propertyTypes);
     }

Modified: sis/branches/JDK8/core/sis-feature/src/test/java/org/apache/sis/feature/EnvelopeOperationTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-feature/src/test/java/org/apache/sis/feature/EnvelopeOperationTest.java?rev=1751436&r1=1751435&r2=1751436&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-feature/src/test/java/org/apache/sis/feature/EnvelopeOperationTest.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-feature/src/test/java/org/apache/sis/feature/EnvelopeOperationTest.java
[UTF-8] Tue Jul  5 10:33:20 2016
@@ -81,7 +81,7 @@ public final strictfp class EnvelopeOper
             null,
             null
         };
-        attributes[4] = FeatureOperations.link(name(AttributeConvention.DEFAULT_GEOMETRY_PROPERTY),
attributes[defaultGeometry]);
+        attributes[4] = FeatureOperations.link(name(AttributeConvention.GEOMETRY_PROPERTY),
attributes[defaultGeometry]);
         attributes[5] = FeatureOperations.envelope(name("bounds"), null, attributes);
         return new DefaultFeatureType(name("school"), false, null, attributes);
     }

Modified: sis/branches/JDK8/core/sis-feature/src/test/java/org/apache/sis/internal/feature/FeatureTypeBuilderTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-feature/src/test/java/org/apache/sis/internal/feature/FeatureTypeBuilderTest.java?rev=1751436&r1=1751435&r2=1751436&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-feature/src/test/java/org/apache/sis/internal/feature/FeatureTypeBuilderTest.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-feature/src/test/java/org/apache/sis/internal/feature/FeatureTypeBuilderTest.java
[UTF-8] Tue Jul  5 10:33:20 2016
@@ -231,10 +231,10 @@ public final strictfp class FeatureTypeB
         final PropertyType a4 = it.next();
         assertFalse("properties count", it.hasNext());
 
-        assertEquals("name", AttributeConvention.ID_PROPERTY,                a0.getName());
-        assertEquals("name", AttributeConvention.ENVELOPE_PROPERTY,          a1.getName());
-        assertEquals("name", AttributeConvention.DEFAULT_GEOMETRY_PROPERTY,  a2.getName());
-        assertEquals("name", "name",                                         a3.getName().toString());
-        assertEquals("name", "shape",                                        a4.getName().toString());
+        assertEquals("name", AttributeConvention.IDENTIFIER_PROPERTY, a0.getName());
+        assertEquals("name", AttributeConvention.ENVELOPE_PROPERTY,   a1.getName());
+        assertEquals("name", AttributeConvention.GEOMETRY_PROPERTY,   a2.getName());
+        assertEquals("name", "name",                                  a3.getName().toString());
+        assertEquals("name", "shape",                                 a4.getName().toString());
     }
 }

Modified: sis/branches/JDK8/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/gpx/GPXConstants.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/gpx/GPXConstants.java?rev=1751436&r1=1751435&r2=1751436&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/gpx/GPXConstants.java
[UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/gpx/GPXConstants.java
[UTF-8] Tue Jul  5 10:33:20 2016
@@ -228,7 +228,7 @@ public final class GPXConstants extends
 
     static {
         final NameFactory   factory  = DefaultFactories.forBuildin(NameFactory.class);
-        final LocalName     geomName = AttributeConvention.DEFAULT_GEOMETRY_PROPERTY;
+        final LocalName     geomName = AttributeConvention.GEOMETRY_PROPERTY;
         final Map<String,?> geomInfo = Collections.singletonMap(AbstractIdentifiedType.NAME_KEY,
geomName);
 
         //-------------------- GENERIC GPX ENTITY ------------------------------



Mime
View raw message