sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1739488 - in /sis/branches/JDK8/core/sis-feature: ./ src/main/java/org/apache/sis/feature/ src/main/java/org/apache/sis/internal/feature/ src/test/java/org/apache/sis/feature/ src/test/java/org/apache/sis/internal/feature/ src/test/java/or...
Date Sat, 16 Apr 2016 16:57:02 GMT
Author: desruisseaux
Date: Sat Apr 16 16:57:02 2016
New Revision: 1739488

URL: http://svn.apache.org/viewvc?rev=1739488&view=rev
Log:
Rename AttributeConvention as NameConvention.
Code formatting, javadoc and tune NameConvention implementation and tests.

Added:
    sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/internal/feature/NameConvention.java
      - copied, changed from r1739487, 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/package-info.java   (with props)
    sis/branches/JDK8/core/sis-feature/src/test/java/org/apache/sis/internal/feature/NameConventionTest.java
      - copied, changed from r1739487, sis/branches/JDK8/core/sis-feature/src/test/java/org/apache/sis/internal/feature/AttributeConventionTest.java
Removed:
    sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/internal/feature/AttributeConvention.java
    sis/branches/JDK8/core/sis-feature/src/test/java/org/apache/sis/internal/feature/AttributeConventionTest.java
Modified:
    sis/branches/JDK8/core/sis-feature/pom.xml
    sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/BoundsOperation.java
    sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/internal/feature/AttributeTypeBuilder.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/BoundsOperationTest.java
    sis/branches/JDK8/core/sis-feature/src/test/java/org/apache/sis/internal/feature/AttributeTypeBuilderTest.java
    sis/branches/JDK8/core/sis-feature/src/test/java/org/apache/sis/internal/feature/FeatureTypeBuilderTest.java
    sis/branches/JDK8/core/sis-feature/src/test/java/org/apache/sis/test/suite/FeatureTestSuite.java

Modified: sis/branches/JDK8/core/sis-feature/pom.xml
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-feature/pom.xml?rev=1739488&r1=1739487&r2=1739488&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-feature/pom.xml (original)
+++ sis/branches/JDK8/core/sis-feature/pom.xml Sat Apr 16 16:57:02 2016
@@ -132,6 +132,20 @@ Representations of geographic features.
       <type>test-jar</type>
       <scope>test</scope>
     </dependency>
+    <dependency>
+      <groupId>org.apache.sis.core</groupId>
+      <artifactId>sis-metadata</artifactId>
+      <version>${project.version}</version>
+      <type>test-jar</type>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.sis.core</groupId>
+      <artifactId>sis-referencing</artifactId>
+      <version>${project.version}</version>
+      <type>test-jar</type>
+      <scope>test</scope>
+    </dependency>
   </dependencies>
 
 </project>

Modified: sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/BoundsOperation.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/BoundsOperation.java?rev=1739488&r1=1739487&r2=1739488&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/BoundsOperation.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/BoundsOperation.java [UTF-8] Sat Apr 16 16:57:02 2016
@@ -26,7 +26,7 @@ import org.opengis.parameter.ParameterDe
 import org.opengis.parameter.ParameterValueGroup;
 import org.opengis.referencing.crs.CoordinateReferenceSystem;
 import org.opengis.referencing.operation.TransformException;
-import org.apache.sis.internal.feature.AttributeConvention;
+import org.apache.sis.internal.feature.NameConvention;
 import org.apache.sis.geometry.Envelopes;
 import org.apache.sis.geometry.GeneralEnvelope;
 
@@ -155,8 +155,8 @@ final class BoundsOperation extends Abst
 
         final FeatureType type = feature.getType();
         for(PropertyType pt : type.getProperties(true)){
-            if(!pt.getName().equals(AttributeConvention.ATTRIBUTE_DEFAULT_GEOMETRY)){
-                if(!AttributeConvention.isGeometryAttribute(pt)) continue;
+            if(!pt.getName().equals(NameConvention.DEFAULT_GEOMETRY_PROPERTY)){
+                if(!NameConvention.isGeometryAttribute(pt)) continue;
             }
 
             final Object val = feature.getPropertyValue(pt.getName().toString());
@@ -169,7 +169,7 @@ final class BoundsOperation extends Abst
                 if(env.isEmpty()) continue;
 
                 //extract geometry enveloppe
-                final CoordinateReferenceSystem geomCrs = AttributeConvention.getCRSCharacteristic(pt);
+                final CoordinateReferenceSystem geomCrs = NameConvention.getCoordinateReferenceSystem(pt);
                 Envelope genv;
                 if(geomCrs!=null){
                     genv = new GeneralEnvelope(geomCrs);

Modified: sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/internal/feature/AttributeTypeBuilder.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/internal/feature/AttributeTypeBuilder.java?rev=1739488&r1=1739487&r2=1739488&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/internal/feature/AttributeTypeBuilder.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/internal/feature/AttributeTypeBuilder.java [UTF-8] Sat Apr 16 16:57:02 2016
@@ -24,7 +24,7 @@ import java.util.List;
 import java.util.Map;
 import org.apache.sis.feature.DefaultAttributeType;
 import static org.apache.sis.feature.AbstractIdentifiedType.*;
-import static org.apache.sis.internal.feature.AttributeConvention.*;
+import static org.apache.sis.internal.feature.NameConvention.*;
 import org.apache.sis.internal.system.DefaultFactories;
 import org.opengis.feature.AttributeType;
 import org.opengis.referencing.crs.CoordinateReferenceSystem;
@@ -36,7 +36,7 @@ import org.opengis.util.NameFactory;
  * This builder can create the parameters to be given to {@linkplain DefaultAttributeType#DefaultAttributeType(
  * java.util.Map, java.lang.Class, int, int, java.lang.Object, org.opengis.feature.AttributeType...)  attribute type constructor}
  * from simpler parameters given to this builder.
- * 
+ *
  * @author Johann Sorel (Geomatys)
  * @since   0.7
  * @version 0.7
@@ -54,7 +54,7 @@ public class AttributeTypeBuilder {
     /**
      * Reset builder parameters to there original values.
      */
-    public void reset(){
+    public void reset() {
         parameters.clear();
         atts.clear();
         valueClass = Object.class;
@@ -68,7 +68,7 @@ public class AttributeTypeBuilder {
      *
      * @param type attribute type to copy parameters from.
      */
-    public void copy(AttributeType type){
+    public void copy(AttributeType type) {
         setName(type.getName());
         setDefinition(type.getDefinition());
         setDescription(type.getDescription());
@@ -85,7 +85,7 @@ public class AttributeTypeBuilder {
      *
      * @param localPart generic name tip part, not null
      */
-    public void setName(String localPart){
+    public void setName(String localPart) {
         this.setName(null,localPart);
     }
 
@@ -95,12 +95,12 @@ public class AttributeTypeBuilder {
      * @param scope generic name scope part, can be null
      * @param localPart generic name tip part, not null
      */
-    public void setName(String scope, String localPart){
+    public void setName(String scope, String localPart) {
         final NameFactory factory = DefaultFactories.forBuildin(NameFactory.class);
-        if(scope==null){
+        if (scope == null) {
             setName(factory.createGenericName(null, localPart));
-        }else{
-            setName(factory.createGenericName(null, scope,  localPart));
+        } else {
+            setName(factory.createGenericName(null, scope, localPart));
         }
     }
 
@@ -122,7 +122,7 @@ public class AttributeTypeBuilder {
      *
      * @param description attribute description
      */
-    public void setDescription(CharSequence description){
+    public void setDescription(CharSequence description) {
         parameters.put(DESCRIPTION_KEY, description);
     }
 
@@ -133,7 +133,7 @@ public class AttributeTypeBuilder {
      *
      * @param designation attribute designation
      */
-    public void setDesignation(CharSequence designation){
+    public void setDesignation(CharSequence designation) {
         parameters.put(DESIGNATION_KEY, designation);
     }
 
@@ -144,7 +144,7 @@ public class AttributeTypeBuilder {
      *
      * @param definition attribute definition
      */
-    public void setDefinition(CharSequence definition){
+    public void setDefinition(CharSequence definition) {
         parameters.put(DEFINITION_KEY, definition);
     }
 
@@ -191,19 +191,19 @@ public class AttributeTypeBuilder {
      * @param length character sequence length
      * @return created characteristic
      */
-    public AttributeType setLengthCharacteristic(int length){
-        return addCharacteristic(CHARACTERISTIC_LENGTH, Integer.class, 1, 1, length);
+    public AttributeType setLengthCharacteristic(int length) {
+        return addCharacteristic(MAXIMAL_LENGTH_CHARACTERISTIC, Integer.class, 1, 1, length);
     }
 
     /**
      * Set attribute {@code CoordinateReferenceSystem}.
      * This characteristic only have a meaning with georeferenced type attributes.
-     * 
+     *
      * @param crs geometry coordinate reference system
      * @return created characteristic
      */
-    public AttributeType setCRSCharacteristic(CoordinateReferenceSystem crs){
-        return addCharacteristic(CHARACTERISTIC_CRS, CoordinateReferenceSystem.class, 1, 1, crs);
+    public AttributeType setCRSCharacteristic(CoordinateReferenceSystem crs) {
+        return addCharacteristic(CRS_CHARACTERISTIC, CoordinateReferenceSystem.class, 1, 1, crs);
     }
 
     /**
@@ -213,8 +213,8 @@ public class AttributeTypeBuilder {
      * @param values enumeration of values
      * @return created characteristic
      */
-    public AttributeType setPossibleValues(Collection values){
-        return addCharacteristic(CHARACTERISTIC_ENUM, Object.class, 1, 1, values);
+    public AttributeType setPossibleValues(Collection values) {
+        return addCharacteristic(VALID_VALUES_CHARACTERISTIC, Object.class, 1, 1, values);
     }
 
     /**
@@ -227,7 +227,7 @@ public class AttributeTypeBuilder {
      * @param defaultValue characteristic default value
      * @return created characteristic
      */
-    public AttributeType addCharacteristic(String localPart, Class valueClass, int minimumOccurs, int maximumOccurs, Object defaultValue){
+    public AttributeType addCharacteristic(String localPart, Class valueClass, int minimumOccurs, int maximumOccurs, Object defaultValue) {
         final NameFactory factory = DefaultFactories.forBuildin(NameFactory.class);
         final GenericName name = factory.createGenericName(null, localPart);
         return addCharacteristic(name,valueClass,minimumOccurs,maximumOccurs,defaultValue);
@@ -243,7 +243,7 @@ public class AttributeTypeBuilder {
      * @param defaultValue characteristic default value
      * @return created characteristic
      */
-    public AttributeType addCharacteristic(GenericName name, Class valueClass, int minimumOccurs, int maximumOccurs, Object defaultValue){
+    public AttributeType addCharacteristic(GenericName name, Class valueClass, int minimumOccurs, int maximumOccurs, Object defaultValue) {
         return addCharacteristic(new DefaultAttributeType(
                     Collections.singletonMap(NAME_KEY, name),
                     valueClass,minimumOccurs,maximumOccurs,defaultValue));
@@ -255,10 +255,10 @@ public class AttributeTypeBuilder {
      * @param characteristic not null
      * @return added characteristic
      */
-    public AttributeType addCharacteristic(AttributeType characteristic){
+    public AttributeType addCharacteristic(AttributeType characteristic) {
         //search and remove previous characteristic with the same id if it exist
-        for(AttributeType at : atts){
-            if(at.getName().equals(characteristic.getName())){
+        for(AttributeType at : atts) {
+            if(at.getName().equals(characteristic.getName())) {
                 atts.remove(at);
                 break;
             }
@@ -272,8 +272,8 @@ public class AttributeTypeBuilder {
      *
      * @return AtributeType, never null
      */
-    public AttributeType build(){
-        return new DefaultAttributeType(parameters, valueClass, 
+    public AttributeType build() {
+        return new DefaultAttributeType(parameters, valueClass,
                 minimumOccurs, maximumOccurs,
                 defaultValue, atts.toArray(new AttributeType[atts.size()]));
     }

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=1739488&r1=1739487&r2=1739488&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] Sat Apr 16 16:57:02 2016
@@ -36,7 +36,7 @@ import org.apache.sis.feature.DefaultFea
 import org.apache.sis.feature.FeatureOperations;
 import org.apache.sis.internal.system.DefaultFactories;
 
-import static org.apache.sis.internal.feature.AttributeConvention.*;
+import static org.apache.sis.internal.feature.NameConvention.*;
 import static org.apache.sis.feature.DefaultFeatureType.*;
 
 // Branch-dependent imports
@@ -265,7 +265,7 @@ public class FeatureTypeBuilder {
         idSeparator = separator;
         idAttributes = attributes;
         //add placeholder
-        properties.put(ATTRIBUTE_ID, null);
+        properties.put(ID_PROPERTY, null);
     }
 
     /**
@@ -295,8 +295,8 @@ public class FeatureTypeBuilder {
     public void setDefaultGeometryOperation(final GenericName attribute) {
         defGeomAttribute = attribute;
         //add placeholder
-        properties.put(ATTRIBUTE_DEFAULT_GEOMETRY, null);
-        properties.put(ATTRIBUTE_BOUNDS, null);
+        properties.put(DEFAULT_GEOMETRY_PROPERTY, null);
+        properties.put(ENVELOPE_PROPERTY, null);
     }
 
     /**
@@ -533,7 +533,7 @@ public class FeatureTypeBuilder {
         final AttributeType<V> att;
         if (crs != null) {
             final AttributeType<CoordinateReferenceSystem> qualifier = new DefaultAttributeType<>(
-                    Collections.singletonMap(NAME_KEY, CHARACTERISTIC_CRS),
+                    Collections.singletonMap(NAME_KEY, CRS_CHARACTERISTIC),
                     CoordinateReferenceSystem.class, 1, 1, crs);
             att = new DefaultAttributeType<>(
                 Collections.singletonMap(NAME_KEY, name),
@@ -680,9 +680,9 @@ public class FeatureTypeBuilder {
             }
 
             final Operation att = FeatureOperations.compound(
-                    Collections.singletonMap(AbstractOperation.NAME_KEY, ATTRIBUTE_ID),
+                    Collections.singletonMap(AbstractOperation.NAME_KEY, ID_PROPERTY),
                     idSeparator, prefix, null, properties.get(idAttributes));
-            properties.put(ATTRIBUTE_ID, att);
+            properties.put(ID_PROPERTY, att);
         }
         //build default geometry property
         if (defGeomAttribute != null) {
@@ -690,13 +690,13 @@ public class FeatureTypeBuilder {
                 throw new IllegalArgumentException("Property "+defGeomAttribute+" used in default geometry does not exist");
             }
             final PropertyType geomAtt = properties.get(defGeomAttribute);
-            final CoordinateReferenceSystem crs = AttributeConvention.getCRSCharacteristic(geomAtt);
+            final CoordinateReferenceSystem crs = NameConvention.getCoordinateReferenceSystem(geomAtt);
             final Operation att = FeatureOperations.link(
-                    Collections.singletonMap(AbstractOperation.NAME_KEY, ATTRIBUTE_DEFAULT_GEOMETRY), geomAtt);
-            properties.put(ATTRIBUTE_DEFAULT_GEOMETRY, att);
+                    Collections.singletonMap(AbstractOperation.NAME_KEY, DEFAULT_GEOMETRY_PROPERTY), geomAtt);
+            properties.put(DEFAULT_GEOMETRY_PROPERTY, att);
 
-            final Operation boundAtt = FeatureOperations.bounds(Collections.singletonMap(AbstractOperation.NAME_KEY, ATTRIBUTE_BOUNDS), crs);
-            properties.put(ATTRIBUTE_BOUNDS, boundAtt);
+            final Operation boundAtt = FeatureOperations.bounds(Collections.singletonMap(AbstractOperation.NAME_KEY, ENVELOPE_PROPERTY), crs);
+            properties.put(ENVELOPE_PROPERTY, boundAtt);
 
         }
 

Copied: sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/internal/feature/NameConvention.java (from r1739487, 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/NameConvention.java?p2=sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/internal/feature/NameConvention.java&p1=sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/internal/feature/AttributeConvention.java&r1=1739487&r2=1739488&rev=1739488&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/NameConvention.java [UTF-8] Sat Apr 16 16:57:02 2016
@@ -17,122 +17,237 @@
 package org.apache.sis.internal.feature;
 
 import com.esri.core.geometry.Geometry;
+import org.opengis.util.LocalName;
+import org.opengis.util.ScopedName;
+import org.opengis.util.GenericName;
+import org.opengis.util.NameFactory;
+import org.opengis.util.NameSpace;
+import org.opengis.referencing.crs.CoordinateReferenceSystem;
 import org.apache.sis.internal.system.DefaultFactories;
+import org.apache.sis.internal.util.Constants;
 import org.apache.sis.util.Static;
+
+// Branch-dependent imports
 import org.opengis.feature.AttributeType;
+import org.opengis.feature.IdentifiedType;
 import org.opengis.feature.Operation;
 import org.opengis.feature.PropertyType;
-import org.opengis.referencing.crs.CoordinateReferenceSystem;
-import org.opengis.util.GenericName;
-import org.opengis.util.NameFactory;
+
 
 /**
- * Features are basically improved java Maps, this convention helps keeping
- * a coherency for the most common use cases.
+ * Defines the names of some properties or characteristics for which we assign a conventional usage.
+ * Properties with the names defined in this {@code NameConvention} class are often aliases generated
+ * by the SIS implementation of various file readers. Those synthetic properties redirect to the most
+ * 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
+ * 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.
+ * </div>
  *
+ * This class defines names for two kinds of usage:
+ * <ul>
+ *   <li>Names ending with {@code "_PROPERTY"} are used for attributes or operations that are members of the
+ *       collection returned by {@link org.apache.sis.feature.DefaultFeatureType#getProperties(boolean)}.</li>
+ *   <li>Names ending with {@code "_CHARACTERISTIC"} are used for characteristics that are entries of the
+ *       map returned by {@link org.apache.sis.feature.DefaultAttributeType#characteristics()}.</li>
+ * </ul>
  *
- * @author Johann Sorel (Geomatys)
+ * <div class="section">Mixing with other conventions</div>
+ * The conventions defined in this class are specific to Apache SIS.
+ * Current implementation does not support any other convention than the SIS one,
+ * 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),
+ * all names defined in this class begin with the {@code "@"} character.</p>
+ *
+ * @author  Johann Sorel (Geomatys)
+ * @author  Martin Desruisseaux (Geomatys)
  * @since   0.7
  * @version 0.7
  * @module
  */
-public final class AttributeConvention extends Static {
-
+public final class NameConvention extends Static {
     /**
-     * Scope used by SIS for convention properties.
+     * Namespace of all names defined by SIS convention.
      */
-    private static final String SIS_SCOPE = "http://sis.apache.org/feature";
+    private static final GenericName NAMESPACE;
 
     /**
-     * Convention name of the feature identifier attribute if there is one in the feature type.
-     * <br>
-     * This attribute should be an Operation which aggregate other attributes.
+     * Conventional name for a property used as a unique identifier.
+     * The identifier should be unique in the {@link org.apache.sis.storage.DataStore} instance containing the feature
+     * (for example a {@code DataStore} opened for a XML file), but does not need to be unique between two independent
+     * {@code DataStore} instances.
+     *
+     * <p>Properties of this name are usually
+     * {@linkplain org.apache.sis.feature.FeatureOperations#link aliases for existing attributes}, or
+     * {@linkplain org.apache.sis.feature.FeatureOperations#compound compound keys} made by concatenation
+     * of two or more other attributes.</p>
+     *
+     * <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 GenericName ATTRIBUTE_ID;
+    public static final LocalName ID_PROPERTY;
+
     /**
-     * Convention name of the default geometry attribute if there is one in the feature type.
-     * <br>
-     * This attribute should be an Operation acting as a redirection to another attribute.
+     * Conventional name for a property containing the geometric object to use by default.
+     * Some features may contain more than one geometric object; this property tells which
+     * geometry to render on a map for example.
+     *
+     * <p>Properties of this name are usually {@linkplain org.apache.sis.feature.FeatureOperations#link
+     * operations acting as a redirection to another attribute}.</p>
+     *
+     * <p>The {@linkplain org.apache.sis.feature.DefaultAttributeType#getValueClass() value class} can be the
+     * {@link Geometry} class from ESRI's API, or the {@code Geometry} class from <cite>Java Topology Suite</cite>
+     * (JTS) library, or any other class defined in future SIS versions. See {@link #isGeometryAttribute(PropertyType)}
+     * for testing whether the value is a supported type.</p>
+     *
+     * @see #isGeometryAttribute(PropertyType)
      */
-    public static final GenericName ATTRIBUTE_DEFAULT_GEOMETRY;
+    public static final LocalName DEFAULT_GEOMETRY_PROPERTY;
+
     /**
-     * Convention name of the feature bounds.
-     * <br>
-     * This attribute should be an Operation.
-     * <br>
-     * Most feature types have a single geometry but in case several geometries
-     * exist the value returned is the concatenation of all first depth geometries.
+     * 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}.
+     * 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
+     * {@linkplain org.apache.sis.feature.FeatureOperations#envelope operations}.</p>
+     *
+     * <p>The {@linkplain org.apache.sis.feature.DefaultAttributeType#getValueClass() value class} should be
+     * {@link org.opengis.geometry.Envelope}.</p>
      */
-    public static final GenericName ATTRIBUTE_BOUNDS;
+    public static final LocalName ENVELOPE_PROPERTY;
+
     /**
-     * Attribute types which store geometries or coverages can have a CoordinateReferenceSystem defined.
-     * <br>
-     * The crs information is stored as default value in the AttributeTypes with this name
-     * of the geometry attribute type.
+     * 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}.
+     *
+     * <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 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>
+     *
+     * <p>The {@linkplain org.apache.sis.feature.DefaultAttributeType#getValueClass() value class} should be
+     * {@link org.opengis.referencing.crs.CoordinateReferenceSystem}.</p>
      */
-    public static final GenericName CHARACTERISTIC_CRS;
+    public static final LocalName CRS_CHARACTERISTIC;
+
     /**
-     * Attribute type which store the string maximum length.
+     * Conventional name for fetching the maximal length of string values.
+     * The maximal length is stored as the
+     * {@linkplain org.apache.sis.feature.DefaultAttributeType#getDefaultValue() default value} of the
+     * {@linkplain org.apache.sis.feature.DefaultAttributeType#characteristics() characteristic} associated
+     * to the attribute on which the maximal length applies.
+     *
+     * <p>The {@linkplain org.apache.sis.feature.DefaultAttributeType#getValueClass() value class} should be
+     * {@link Integer}.</p>
      */
-    public static final GenericName CHARACTERISTIC_LENGTH;
+    public static final LocalName MAXIMAL_LENGTH_CHARACTERISTIC;
+
     /**
-     * Attribute type which store the enumeration of possible values.
+     * Conventional name for fetching the enumeration of valid values.
+     * The set of valid values is stored stored as the
+     * {@linkplain org.apache.sis.feature.DefaultAttributeType#getDefaultValue() default value} of the
+     * {@linkplain org.apache.sis.feature.DefaultAttributeType#characteristics() characteristic} associated
+     * to the attribute on which the restriction applies.
      */
-    public static final GenericName CHARACTERISTIC_ENUM;
+    public static final LocalName VALID_VALUES_CHARACTERISTIC;
 
     static {
         final NameFactory factory = DefaultFactories.forBuildin(NameFactory.class);
-        ATTRIBUTE_ID = factory.createGenericName(null, SIS_SCOPE,  "@id");
-        ATTRIBUTE_DEFAULT_GEOMETRY = factory.createGenericName(null, SIS_SCOPE,  "@defaultgeom");
-        ATTRIBUTE_BOUNDS = factory.createGenericName(null, SIS_SCOPE,  "@bounds");
-        CHARACTERISTIC_CRS = factory.createGenericName(null, SIS_SCOPE,  "@crs");
-        CHARACTERISTIC_LENGTH = factory.createGenericName(null, SIS_SCOPE,  "@length");
-        CHARACTERISTIC_ENUM = factory.createGenericName(null, SIS_SCOPE,  "@enum");
+        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, "@defaultGeometry");
+        ENVELOPE_PROPERTY             = factory.createLocalName(ns, "@envelope");
+        CRS_CHARACTERISTIC            = factory.createLocalName(ns, "@crs");
+        MAXIMAL_LENGTH_CHARACTERISTIC = factory.createLocalName(ns, "@maximalLength");
+        VALID_VALUES_CHARACTERISTIC   = factory.createLocalName(ns, "@validValues");
     }
 
     /**
-     * Convention properties are properties added to the real feature type
-     * to offer access to common informations.
-     * <br>
-     * Such properties should not be stored when writing, those are calculate
-     * most of the time and have only a meaning within SIS.
-     *
-     * @param property tested property, not null
-     * @return true if property is a convention property.
+     * Do not allow instantiation of this class.
      */
-    public static boolean isConventionProperty(PropertyType property){
-        return property.getName().toString().startsWith(SIS_SCOPE);
+    private NameConvention() {
     }
-    
+
     /**
-     * Indicate of given PropertyType is a geometry type.
-     * <br>
-     * This implies property is an attribute and the value class is a type of Geometry.
+     * Returns {@code true} if the given name stands for one of the synthetic properties defined by convention.
+     * Conventional properties are properties added by the {@code DataStore} to the {@code FeatureType} in order
+     * to provide a uniform way to access commonly used informations.
+     *
+     * <p>Synthetic properties should generally not be written by the user.
+     * Those properties are calculated most of the time and have only a meaning within SIS.</p>
      *
-     * @param propertyType tested property type, not null
-     * @return true if property type is for geometries
+     * <p>Current implementation returns {@code true} if the given name is in the SIS namespace.</p>
+     *
+     * @param  name  the name of the property or characteristic to test, or {@code null}.
+     * @return {@code true} if the given name is non-null and in the SIS namespace.
      */
-    public static boolean isGeometryAttribute(PropertyType propertyType){
-        if(propertyType instanceof AttributeType){
-            return Geometry.class.isAssignableFrom(((AttributeType)propertyType).getValueClass());
-        }else{
+    public static boolean contains(final GenericName name) {
+        if (name == null) {
             return false;
         }
+        final GenericName scope;
+        if (name instanceof ScopedName) {
+            scope = ((ScopedName) name).path().toFullyQualifiedName();
+        } else {
+            scope = name.scope().name();
+        }
+        return NAMESPACE.equals(scope);
     }
 
     /**
-     * Extract CRS characteristic if it exist.
-     * 
-     * @param type tested property type, not null
-     * @return CoordinateReferenceSystem or null
-     */
-    public static CoordinateReferenceSystem getCRSCharacteristic(PropertyType type){
-        while(type instanceof Operation){
-            type = (PropertyType) ((Operation)type).getResult();
-        }
-        if(type instanceof AttributeType){
-            final AttributeType at = (AttributeType) ((AttributeType)type).characteristics().get(CHARACTERISTIC_CRS.toString());
-            if(at!=null){
+     * Returns {@code true} if the given type is an {@link AttributeType} or an {@link Operation} computing
+     * an attribute, and the attribute value is one of the geometry types recognized by SIS.
+     * The types currently recognized by SIS are:
+     *
+     * <ul>
+     *   <li>{@link com.esri.core.geometry.Geometry} of the ESRI's API.</li>
+     * </ul>
+     *
+     * The above list may be expanded in any future SIS version.
+     *
+     * @param  type  the type to test, or {@code null}.
+     * @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
+     */
+    public static boolean isGeometryAttribute(IdentifiedType type) {
+        while (type instanceof Operation) {
+            type = ((Operation) type).getResult();
+        }
+        if (type instanceof AttributeType<?>) {
+            final Class<?> valueClass = ((AttributeType<?>) type).getValueClass();
+            return Geometry.class.isAssignableFrom(valueClass);
+        }
+        return false;
+    }
+
+    /**
+     * Returns the coordinate reference systems associated to the given operation or attribute type,
+     * or {@code null} if none. This method searches for a characteristic named {@link #CRS_CHARACTERISTIC}.
+     *
+     * @param  type  the operation or attribute type for which to get the CRS, or {@code null}.
+     * @return The Coordinate Reference System for the given type, or {@code null} if none.
+     * @throws ClassCastException if {@link #CRS_CHARACTERISTIC} has been found but is associated
+     *         to an object which is not a {@link CoordinateReferenceSystem} instance.
+     */
+    public static CoordinateReferenceSystem getCoordinateReferenceSystem(IdentifiedType type) {
+        while (type instanceof Operation) {
+            type = ((Operation) type).getResult();
+        }
+        if (type instanceof AttributeType<?>) {
+            final AttributeType<?> at = ((AttributeType<?>) type).characteristics().get(CRS_CHARACTERISTIC.toString());
+            if (at != null) {
                 return (CoordinateReferenceSystem) at.getDefaultValue();
             }
         }
@@ -140,17 +255,21 @@ public final class AttributeConvention e
     }
 
     /**
-     * Extract field length characteristic if it exist.
+     * Returns the maximal string length associated to the given attribute type, or {@code null} if none.
+     * This method searches for a characteristic named {@link #MAXIMAL_LENGTH_CHARACTERISTIC}.
      *
-     * @param type tested property type, not null
-     * @return Length or null
-     */
-    public static Integer getLengthCharacteristic(AttributeType type){
-        final AttributeType at = (AttributeType) type.characteristics().get(CHARACTERISTIC_LENGTH.toString());
-        if(at!=null){
-            return (Integer) at.getDefaultValue();
+     * @param  type  the attribute type for which to get the maximal string length, or {@code null}.
+     * @return The maximal string length for the given type, or {@code null} if none.
+     * @throws ClassCastException if {@link #MAXIMAL_LENGTH_CHARACTERISTIC} has been found
+     *         but is associated to an object which is not an {@link Integer} instance.
+     */
+    public static Integer getMaximalLength(final AttributeType<?> type){
+        if (type != null) {
+            final AttributeType<?> at = type.characteristics().get(MAXIMAL_LENGTH_CHARACTERISTIC.toString());
+            if (at != null) {
+                return (Integer) at.getDefaultValue();
+            }
         }
         return null;
     }
-
 }

Added: sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/internal/feature/package-info.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/internal/feature/package-info.java?rev=1739488&view=auto
==============================================================================
--- sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/internal/feature/package-info.java (added)
+++ sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/internal/feature/package-info.java [UTF-8] Sat Apr 16 16:57:02 2016
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * A set of helper classes for the SIS implementation.
+ * contains also classes that may move to the public API someday,
+ * but are considered not yet ready.
+ *
+ * <p><strong>Do not use!</strong></p>
+ *
+ * This package is for internal use by SIS only. Classes in this package
+ * may change in incompatible ways in any future version without notice.
+ *
+ * @author  Johann Sorel (Geomatys)
+ * @since   0.7
+ * @version 0.7
+ * @module
+ */
+package org.apache.sis.internal.feature;

Propchange: sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/internal/feature/package-info.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/internal/feature/package-info.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain;charset=UTF-8

Modified: sis/branches/JDK8/core/sis-feature/src/test/java/org/apache/sis/feature/BoundsOperationTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-feature/src/test/java/org/apache/sis/feature/BoundsOperationTest.java?rev=1739488&r1=1739487&r2=1739488&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-feature/src/test/java/org/apache/sis/feature/BoundsOperationTest.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-feature/src/test/java/org/apache/sis/feature/BoundsOperationTest.java [UTF-8] Sat Apr 16 16:57:02 2016
@@ -111,10 +111,8 @@ public final strictfp class BoundsOperat
         bounds.setRange(0, -31, 18);
         bounds.setRange(1, -6, 40);
         assertEquals(bounds,feature.getPropertyValue("bounds"));
-
     }
 
-
     /**
      * Tests a dense type with operations.
      */

Modified: sis/branches/JDK8/core/sis-feature/src/test/java/org/apache/sis/internal/feature/AttributeTypeBuilderTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-feature/src/test/java/org/apache/sis/internal/feature/AttributeTypeBuilderTest.java?rev=1739488&r1=1739487&r2=1739488&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-feature/src/test/java/org/apache/sis/internal/feature/AttributeTypeBuilderTest.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-feature/src/test/java/org/apache/sis/internal/feature/AttributeTypeBuilderTest.java [UTF-8] Sat Apr 16 16:57:02 2016
@@ -87,7 +87,7 @@ public class AttributeTypeBuilderTest ex
         assertEquals("test text with words and letters.", att.getDefaultValue());
         assertEquals(10, att.getMinimumOccurs());
         assertEquals(60, att.getMaximumOccurs());
-        assertEquals(80, (int)AttributeConvention.getLengthCharacteristic(att));
+        assertEquals(80, (int)NameConvention.getMaximalLength(att));
     }
 
     /**
@@ -121,7 +121,7 @@ public class AttributeTypeBuilderTest ex
         assertEquals("test text with words and letters.", att.getDefaultValue());
         assertEquals(10, att.getMinimumOccurs());
         assertEquals(60, att.getMaximumOccurs());
-        assertEquals(80, (int)AttributeConvention.getLengthCharacteristic(att));
+        assertEquals(80, (int)NameConvention.getMaximalLength(att));
     }
 
     /**

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=1739488&r1=1739487&r2=1739488&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] Sat Apr 16 16:57:02 2016
@@ -222,9 +222,9 @@ public class FeatureTypeBuilderTest exte
         assertEquals(5, type.getProperties(true).size());
 
         final List<PropertyType> properties = new ArrayList(type.getProperties(true));
-        assertEquals(AttributeConvention.ATTRIBUTE_ID, properties.get(0).getName());
-        assertEquals(AttributeConvention.ATTRIBUTE_DEFAULT_GEOMETRY, properties.get(1).getName());
-        assertEquals(AttributeConvention.ATTRIBUTE_BOUNDS, properties.get(2).getName());
+        assertEquals(NameConvention.ID_PROPERTY, properties.get(0).getName());
+        assertEquals(NameConvention.DEFAULT_GEOMETRY_PROPERTY, properties.get(1).getName());
+        assertEquals(NameConvention.ENVELOPE_PROPERTY, properties.get(2).getName());
         assertEquals("name", properties.get(3).getName().toString());
         assertEquals("shape", properties.get(4).getName().toString());
     }

Copied: sis/branches/JDK8/core/sis-feature/src/test/java/org/apache/sis/internal/feature/NameConventionTest.java (from r1739487, sis/branches/JDK8/core/sis-feature/src/test/java/org/apache/sis/internal/feature/AttributeConventionTest.java)
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-feature/src/test/java/org/apache/sis/internal/feature/NameConventionTest.java?p2=sis/branches/JDK8/core/sis-feature/src/test/java/org/apache/sis/internal/feature/NameConventionTest.java&p1=sis/branches/JDK8/core/sis-feature/src/test/java/org/apache/sis/internal/feature/AttributeConventionTest.java&r1=1739487&r2=1739488&rev=1739488&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-feature/src/test/java/org/apache/sis/internal/feature/AttributeConventionTest.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-feature/src/test/java/org/apache/sis/internal/feature/NameConventionTest.java [UTF-8] Sat Apr 16 16:57:02 2016
@@ -16,88 +16,93 @@
  */
 package org.apache.sis.internal.feature;
 
+import java.util.Map;
+import java.util.Collections;
 import com.esri.core.geometry.Point;
-import org.apache.sis.referencing.CommonCRS;
+import org.opengis.referencing.crs.CoordinateReferenceSystem;
+import org.apache.sis.referencing.crs.HardCodedCRS;
+import org.apache.sis.feature.DefaultAttributeType;
+import org.apache.sis.util.iso.Names;
 import org.apache.sis.test.TestCase;
-import static org.junit.Assert.*;
 import org.junit.Test;
 
+import static org.junit.Assert.*;
+
+// Branch-dependent imports
+import org.opengis.feature.AttributeType;
+import org.opengis.feature.IdentifiedType;
+
+
 /**
- * Tests {@link AttributeConvention}.
+ * Tests {@link NameConvention}.
  *
- * @author Johann Sorel (Geomatys)
+ * @author  Johann Sorel (Geomatys)
  * @since   0.7
  * @version 0.7
  * @module
  */
-public class AttributeConventionTest extends TestCase {
-
+public final strictfp class NameConventionTest extends TestCase {
     /**
-     * Test of isConventionProperty method, of class AttributeConvention.
+     * Tests {@link NameConvention#contains(GenericName)} method.
      */
     @Test
     public void testIsConventionProperty() {
-        final AttributeTypeBuilder atb = new AttributeTypeBuilder();
-        atb.setName("age");
-        atb.setValueClass(Integer.class);
-        assertFalse(AttributeConvention.isConventionProperty(atb.build()));
-
-        atb.reset();
-        atb.setName("http://sis.apache.org/feature","age");
-        atb.setValueClass(Integer.class);
-        assertTrue(AttributeConvention.isConventionProperty(atb.build()));
-
+        assertFalse("Feature-specific name", NameConvention.contains(Names.createLocalName("MyFeature", ":", "City")));
+        assertTrue ("Conventional name",     NameConvention.contains(NameConvention.ENVELOPE_PROPERTY));
+        assertTrue ("Fully qualified name",  NameConvention.contains(NameConvention.ENVELOPE_PROPERTY.toFullyQualifiedName()));
     }
 
     /**
-     * Test of isGeometryAttribute method, of class AttributeConvention.
+     * Tests {@link NameConvention#isGeometryAttribute(IdentifiedType)} method.
      */
     @Test
     public void testIsGeometryAttribute() {
-        final AttributeTypeBuilder atb = new AttributeTypeBuilder();
-        atb.setName("geometry");
-        atb.setValueClass(Integer.class);
-        assertFalse(AttributeConvention.isGeometryAttribute(atb.build()));
-
-        atb.reset();
-        atb.setName("geometry");
-        atb.setValueClass(Point.class);
-        assertTrue(AttributeConvention.isGeometryAttribute(atb.build()));
+        final Map<String,?> properties = Collections.singletonMap(DefaultAttributeType.NAME_KEY, "geometry");
+
+        assertFalse("AttributeType<Integer>", NameConvention.isGeometryAttribute(
+                new DefaultAttributeType<>(properties, Integer.class, 1, 1, null)));
+
+        assertTrue("AttributeType<Point>", NameConvention.isGeometryAttribute(
+                new DefaultAttributeType<>(properties, Point.class, 1, 1, null)));
     }
 
     /**
-     * Test of getCRSCharacteristic method, of class AttributeConvention.
+     * Tests {@link NameConvention#getCoordinateReferenceSystem(IdentifiedType)} method.
      */
     @Test
-    public void testGetCRSCharacteristic() {
-        final AttributeTypeBuilder atb = new AttributeTypeBuilder();
-        atb.setName("geometry");
-        atb.setValueClass(Point.class);
-        assertEquals(null,AttributeConvention.getCRSCharacteristic(atb.build()));
-
-        atb.reset();
-        atb.setName("geometry");
-        atb.setValueClass(Point.class);
-        atb.setCRSCharacteristic(CommonCRS.WGS84.geographic());
-        assertEquals(CommonCRS.WGS84.geographic(),AttributeConvention.getCRSCharacteristic(atb.build()));
+    public void testGetCoordinateReferenceSystem() {
+        final Map<String,?> properties = Collections.singletonMap(DefaultAttributeType.NAME_KEY, "geometry");
+        DefaultAttributeType<Point> type = new DefaultAttributeType<>(properties, Point.class, 1, 1, null);
+        assertNull("Without characteristic", NameConvention.getCoordinateReferenceSystem(type));
+        /*
+         * Creates an attribute associated to an attribute (i.e. a "characteristic") for storing
+         * the Coordinate Reference System of the "geometry" attribute. Then test again.
+         */
+        final DefaultAttributeType<CoordinateReferenceSystem> characteristic = new DefaultAttributeType<>(
+                Collections.singletonMap(DefaultAttributeType.NAME_KEY, NameConvention.CRS_CHARACTERISTIC),
+                CoordinateReferenceSystem.class, 1, 1, HardCodedCRS.WGS84);
+
+        type = new DefaultAttributeType<>(properties, Point.class, 1, 1, null, characteristic);
+        assertEquals(HardCodedCRS.WGS84, NameConvention.getCoordinateReferenceSystem(type));
     }
 
     /**
-     * Test of getLengthCharacteristic method, of class AttributeConvention.
+     * Tests {@link NameConvention#getMaximalLength(AttributeType)} method.
      */
     @Test
-    public void testGetLengthCharacteristic() {
-        final AttributeTypeBuilder atb = new AttributeTypeBuilder();
-        atb.setName("name");
-        atb.setValueClass(String.class);
-        assertEquals((Integer)null,AttributeConvention.getLengthCharacteristic(atb.build()));
-
-        atb.reset();
-        atb.setName("name");
-        atb.setValueClass(String.class);
-        atb.setLengthCharacteristic(120);
-        assertEquals((Integer)120,AttributeConvention.getLengthCharacteristic(atb.build()));
-    }
-
+    public void testGetMaximalLength() {
+        final Map<String,?> properties = Collections.singletonMap(DefaultAttributeType.NAME_KEY, "name");
+        DefaultAttributeType<String> type = new DefaultAttributeType<>(properties, String.class, 1, 1, null);
+        assertNull("Without characteristic", NameConvention.getMaximalLength(type));
+        /*
+         * Creates an attribute associated to an attribute (i.e. a "characteristic") for storing
+         * the maximal length of the "name" attribute. Then test again.
+         */
+        final DefaultAttributeType<Integer> characteristic = new DefaultAttributeType<>(
+                Collections.singletonMap(DefaultAttributeType.NAME_KEY, NameConvention.MAXIMAL_LENGTH_CHARACTERISTIC),
+                Integer.class, 1, 1, 120);
 
+        type = new DefaultAttributeType<>(properties, String.class, 1, 1, null, characteristic);
+        assertEquals(Integer.valueOf(120), NameConvention.getMaximalLength(type));
+    }
 }

Modified: sis/branches/JDK8/core/sis-feature/src/test/java/org/apache/sis/test/suite/FeatureTestSuite.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-feature/src/test/java/org/apache/sis/test/suite/FeatureTestSuite.java?rev=1739488&r1=1739487&r2=1739488&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-feature/src/test/java/org/apache/sis/test/suite/FeatureTestSuite.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-feature/src/test/java/org/apache/sis/test/suite/FeatureTestSuite.java [UTF-8] Sat Apr 16 16:57:02 2016
@@ -50,7 +50,7 @@ import org.junit.BeforeClass;
     org.apache.sis.feature.FeaturesTest.class,
     org.apache.sis.filter.DefaultLiteralTest.class,
     org.apache.sis.filter.DefaultPropertyNameTest.class,
-    org.apache.sis.internal.feature.AttributeConventionTest.class,
+    org.apache.sis.internal.feature.NameConventionTest.class,
     org.apache.sis.internal.feature.AttributeTypeBuilderTest.class,
     org.apache.sis.internal.feature.FeatureTypeBuilderTest.class
 })



Mime
View raw message