sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1593149 - in /sis/branches/JDK8: core/sis-feature/src/main/java/org/apache/sis/feature/ core/sis-feature/src/test/java/org/apache/sis/feature/ storage/sis-shapefile/src/main/java/org/apache/sis/storage/shapefile/
Date Wed, 07 May 2014 22:31:28 GMT
Author: desruisseaux
Date: Wed May  7 22:31:28 2014
New Revision: 1593149

URL: http://svn.apache.org/r1593149
Log:
Attempt to simplify the feature model. The ISO 19109 specification said that attributes may
have a [0 ... n] cardinality,
but does not said how multi-occurrences should be represented. There is 2 ways to represent
an occurrence of n attributes:

  1) As n instance of Attribute, where each Attribute contains one value.
  2) As only once instance of Attribute, which contains n value (e.g. as a collection).

The old GeoAPI model in the org.opengis.feature package was implementing approach 1, so our
previous org.apache.sis.feature
model was following the same path.  However after seeing where this approach was leading us
(more complexity in the form of
special PropertyList and PropertySingleton implementations for keeping decent performances)
and after discussion with users
of previous model, we feel that approach 2 would be both simpler and a better fit for users
of Features.

In this commit, we change the cardinality of 'DefaultFeature.getProperty(String)' from [0
... n] to [0 ... 1].
A future commit will need to change the cardinality of 'DefaultAttribute.getValue()' from
[0 ... 1] to [0 ... n],
with a convenience method for the very common case where we know that n = 1.

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/DefaultAttribute.java
    sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/DefaultFeature.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/package-info.java
    sis/branches/JDK8/core/sis-feature/src/test/java/org/apache/sis/feature/DefaultFeatureTest.java
    sis/branches/JDK8/core/sis-feature/src/test/java/org/apache/sis/feature/DefaultFeatureTypeTest.java
    sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/storage/shapefile/ShapeFile.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=1593149&r1=1593148&r2=1593149&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] Wed May  7 22:31:28 2014
@@ -179,7 +179,8 @@ public class AbstractIdentifiedType impl
         } else if (value instanceof GenericName) {
             name = (GenericName) value;
         } else {
-            throw illegalPropertyType(properties, NAME_KEY, value);
+            throw new IllegalArgumentException(Errors.getResources(properties).getString(
+                    Errors.Keys.IllegalPropertyClass_2, NAME_KEY, value.getClass()));
         }
         definition  = Types.toInternationalString(properties, DEFINITION_KEY );
         designation = Types.toInternationalString(properties, DESIGNATION_KEY);
@@ -187,16 +188,6 @@ public class AbstractIdentifiedType impl
     }
 
     /**
-     * Returns the exception to be thrown when a property is of illegal type.
-     */
-    private static IllegalArgumentException illegalPropertyType(
-            final Map<String,?> properties, final String key, final Object value)
-    {
-        return new IllegalArgumentException(Errors.getResources(properties)
-                .getString(Errors.Keys.IllegalPropertyClass_2, key, value.getClass()));
-    }
-
-    /**
      * 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/DefaultAttribute.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/DefaultAttribute.java?rev=1593149&r1=1593148&r2=1593149&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/DefaultAttribute.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/DefaultAttribute.java
[UTF-8] Wed May  7 22:31:28 2014
@@ -63,15 +63,28 @@ public class DefaultAttribute<T> impleme
     private T value;
 
     /**
-     * Creates a new attribute of the given type.
-     * The value is initialized to the {@linkplain DefaultAttributeType#getDefaultValue()
default value}.
+     * Creates a new attribute of the given type initialized to the
+     * {@linkplain DefaultAttributeType#getDefaultValue() default value}.
      *
      * @param type Information about the attribute (base Java class, domain of values, <i>etc.</i>).
      */
     public DefaultAttribute(final DefaultAttributeType<T> type) {
         ArgumentChecks.ensureNonNull("type", type);
-        this.type = type;
-        value = type.getDefaultValue();
+        this.type  = type;
+        this.value = type.getDefaultValue();
+    }
+
+    /**
+     * Creates a new attribute of the given type initialized to the given value.
+     * Note that a {@code null} value may not the same as the default value.
+     *
+     * @param type  Information about the attribute (base Java class, domain of values, <i>etc.</i>).
+     * @param value The initial value (may be null {@code null}).
+     */
+    public DefaultAttribute(final DefaultAttributeType<T> type, final Object value)
{
+        ArgumentChecks.ensureNonNull("type", type);
+        this.type  = type;
+        this.value = type.getValueClass().cast(value);
     }
 
     /**
@@ -88,7 +101,7 @@ public class DefaultAttribute<T> impleme
      *
      * @return The attribute value (may be {@code null}).
      *
-     * @see DefaultFeature#getAttributeValue(String)
+     * @see DefaultFeature#getPropertyValue(String)
      */
     public T getValue() {
         return value;
@@ -107,7 +120,7 @@ public class DefaultAttribute<T> impleme
      *         <span style="color:firebrick">This exception will be changed to {@code
IllegalAttributeException} in a
      *         future SIS version.</span>
      *
-     * @see DefaultFeature#setAttributeValue(String, Object)
+     * @see DefaultFeature#setPropertyValue(String, Object)
      */
     public void setValue(final T value) {
         this.value = value;

Modified: sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/DefaultFeature.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/DefaultFeature.java?rev=1593149&r1=1593148&r2=1593149&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/DefaultFeature.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/DefaultFeature.java
[UTF-8] Wed May  7 22:31:28 2014
@@ -16,7 +16,6 @@
  */
 package org.apache.sis.feature;
 
-import java.util.List;
 import java.util.Map;
 import java.util.HashMap;
 import java.util.ConcurrentModificationException;
@@ -26,12 +25,16 @@ import org.apache.sis.util.ArgumentCheck
 import org.apache.sis.util.resources.Errors;
 import org.apache.sis.util.collection.Containers;
 
-// Related to JDK7
-import java.util.Objects;
-
 
 /**
  * An instance of a {@linkplain DefaultFeatureType feature type} containing values for a
real-world phenomena.
+ * Each feature instance can provide values for the following properties:
+ *
+ * <ul>
+ *   <li>{@linkplain DefaultAttribute   Attributes}</li>
+ *   <li>{@linkplain DefaultAssociation Associations to other feature types}</li>
+ *   <li>{@linkplain DefaultOperation   Operations}</li>
+ * </ul>
  *
  * {@section Usage in multi-thread environment}
  * {@code DefaultFeature} are <strong>not</strong> thread-safe.
@@ -57,29 +60,29 @@ public class DefaultFeature implements S
 
     /**
      * The properties (attributes, operations, feature associations) of this feature.
-     * Each value can be one of the following types (from most generic to most specific):
      *
-     * <ul>
-     *   <li>A {@link PropertyList}, which is a list of {@code Attribute}.</li>
-     *   <li>An {@code Attribute} in the common case of [0…1] cardinality.</li>
-     *   <li>An object in the common case of [0…1] cardinality when only the value
-     *       (not the {@code Attribute} object) is requested.</li>
-     * </ul>
-     *
-     * The intend is to reduce the amount of allocate objects as much as possible,
-     * because typical SIS applications may create a very large amount of features.
+     * Conceptually, values in this map are {@link Property} instances. However at first
we will store
+     * only the property <em>values</em>, and build the full {@code Property}
objects only if they are
+     * requested. The intend is to reduce the amount of allocated objects as much as possible,
because
+     * typical SIS applications may create a very large amount of features.
      */
     private final Map<String, Object> properties;
 
     /**
-     * Creates a new features.
+     * {@code true} if the {@link #properties} map contains fully created {@link Property}
instances,
+     * or {@code false} if the map contains only the property values.
+     */
+    private boolean asPropertyInstances;
+
+    /**
+     * Creates a new feature of the given type.
      *
      * @param type Information about the feature (name, characteristics, <i>etc.</i>).
      */
     public DefaultFeature(final DefaultFeatureType type) {
         ArgumentChecks.ensureNonNull("type", type);
         this.type = type;
-        properties = new HashMap<>(Math.min(16, Containers.hashMapCapacity(type.getCharacteristics().size())));
+        properties = new HashMap<>(Math.min(16, Containers.hashMapCapacity(type.characteristics().size())));
     }
 
     /**
@@ -92,101 +95,95 @@ public class DefaultFeature implements S
     }
 
     /**
-     * Returns all properties (attributes, operations or associations) of the given name.
-     * The returned list is <em>live</em>: change in that list will be immediately
reflected
-     * in this {@code DefaultFeature}, and conversely.
+     * Returns the type for the property of the given name.
+     *
+     * @param  name The property name.
+     * @return The type for the property of the given name (never {@code null}).
+     * @throws IllegalArgumentException If the given argument is not a property name of this
feature.
+     */
+    private DefaultAttributeType<?> getPropertyType(final String name) throws IllegalArgumentException
{
+        final DefaultAttributeType<?> pt = type.getProperty(name);
+        if (pt != null) {
+            return pt;
+        }
+        throw new IllegalArgumentException(Errors.format(Errors.Keys.PropertyNotFound_2,
type.getName(), name));
+    }
+
+    /**
+     * Returns the property (attribute, operation or association) of the given name.
      *
-     * <div class="warning">In a future SIS version, the type of list elements may
be changed
+     * <div class="warning"><b>Warning:</b> In a future SIS version, the
return type may be changed
      * to {@code org.opengis.feature.Property}. This change is pending GeoAPI revision.</div>
      *
      * @param  name The property name.
-     * @return All properties of the given name, or an empty list if none.
+     * @return The property of the given name.
      * @throws IllegalArgumentException If the given argument is not a property name of this
feature.
      */
-    public List<DefaultAttribute<?>> properties(final String name) throws IllegalArgumentException
{
+    public DefaultAttribute<?> getProperty(final String name) throws IllegalArgumentException
{
         ArgumentChecks.ensureNonNull("name", name);
-        final DefaultAttributeType<?> at = type.getProperty(name);
-        if (at == null) {
-            throw new IllegalArgumentException(propertyNotFound(name));
-        }
-        /*
-         * In the majority of cases, the feature allows at most one attribute for the given
name.
-         * In order to save a little bit of space (because SIS applications may have a very
large
-         * amount of features), we will not store the list in this DefaultFeature. Instead,
we use
-         * a temporary object which will read and write the Attribute instance directly in
the map.
-         */
-        final int maximumOccurs = at.getMaximumOccurs();
-        if (maximumOccurs <= 1) {
-            return new PropertySingleton(at, properties, name);
-        }
         /*
-         * If the property allows more than one feature, then we need a real List implementation.
-         * This case is less frequent, so we test it last.
+         * Wraps values in Property objects for all entries in the properties map,
+         * if not already done. This operation is execute at most once per feature.
          */
-        Object element = properties.get(name);
-        if (element == null) {
-            element = new PropertyList(at, maximumOccurs);
-            if (properties.put(name, element) != null) {
-                throw new ConcurrentModificationException(name);
+        if (!asPropertyInstances) {
+            asPropertyInstances = true;
+            for (final Map.Entry<String, Object> entry : properties.entrySet()) {
+                final String key   = entry.getKey();
+                final Object value = entry.getValue();
+                if (entry.setValue(new DefaultAttribute<>(getPropertyType(key), value))
!= value) {
+                    throw new ConcurrentModificationException(key);
+                }
             }
         }
-        return (PropertyList) element;
+        return getPropertyInstance(name);
     }
 
     /**
-     * Returns the value(s) of all attribute of the given name.
-     * This convenience method combines a call to {@link #properties(String)} followed by
calls to
-     * {@link DefaultAttribute#getValue()} for each attribute, but may potentially be more
efficient.
-     *
-     * <p>The type of the returned object depends on the {@linkplain DefaultAttributeType#getMaximumOccurs()
-     * maximum number of occurrences} of the named attribute:</p>
+     * Implementation of {@link #getProperty(String)} invoked when we known that the {@link
#properties}
+     * map contains {@code Property} instances (as opposed to their value).
+     */
+    private DefaultAttribute<?> getPropertyInstance(final String name) throws IllegalArgumentException
{
+        DefaultAttribute<?> property = (DefaultAttribute<?>) properties.get(name);
+        if (property == null) {
+            property = new DefaultAttribute<>(getPropertyType(name));
+            replace(name, null, property);
+        }
+        return property;
+    }
+
+    /**
+     * Returns the value for the property of the given name.
+     * This convenience method is equivalent to the following code,
+     * except that this method is potentially more efficient:
      *
-     * <ul>
-     *   <li>If the attribute is allowed to occur at most once (which is the usual
case of <cite>simple
-     *       features</cite>), then this method returns either the singleton value
or {@code null}.</li>
-     *   <li>Otherwise this method will always return a {@link List}.
-     *       That list may be empty but never {@code null}.</li>
-     * </ul>
+     * {@preformat
+     *     return getProperty(name).getValue();
+     * }
      *
-     * @param  name The attribute name.
-     * @return The value or list of values for the given attribute(s), or {@code null} if
none.
-     * @throws IllegalArgumentException If the given argument is not an attribute name of
this feature.
+     * @param  name The property name.
+     * @return The value for the given property, or {@code null} if none.
+     * @throws IllegalArgumentException If the given argument is not a property name of this
feature.
      *
      * @see DefaultAttribute#getValue()
      */
-    public Object getAttributeValue(final String name) throws IllegalArgumentException {
+    public Object getPropertyValue(final String name) throws IllegalArgumentException {
         ArgumentChecks.ensureNonNull("name", name);
         final Object element = properties.get(name);
-        /*
-         * If there is no value for the given name, first ensure that the name is valid,
-         * then return the default value without storing any object in this DefaultFeature.
-         */
-        if (element == null) {
-            final DefaultAttributeType<?> at = type.getProperty(name);
-            if (at == null) {
-                throw new IllegalArgumentException(propertyNotFound(name));
-            }
-            final int maximumOccurs = at.getMaximumOccurs();
-            if (maximumOccurs <= 1) {
-                return at.getDefaultValue();
-            }
-            final PropertyList list = new PropertyList(at, maximumOccurs);
-            if (properties.put(name, list) != null) {
-                throw new ConcurrentModificationException(name);
+        if (element != null) {
+            if (!asPropertyInstances) {
+                return element;
+            } else {
+                return ((DefaultAttribute<?>) element).getValue();
             }
-            return list;
-        }
-        if (element instanceof DefaultAttribute<?>) {
-            return ((DefaultAttribute<?>) element).getValue();
-        }
-        if (element instanceof PropertyList) {
-            // TODO
+        } else if (properties.containsKey(name)) {
+            return null; // Null has been explicitely set.
+        } else {
+            return getPropertyType(name).getDefaultValue();
         }
-        return element;
     }
 
     /**
-     * Sets the value of the attribute of the given name.
+     * Sets the value for the property of the given name.
      *
      * {@section Validation}
      * The amount of validation performed by this method is implementation dependent.
@@ -196,62 +193,71 @@ public class DefaultFeature implements S
      * @param  name  The attribute name.
      * @param  value The new value for the given attribute (may be {@code null}).
      * @throws IllegalArgumentException If the given argument is not an attribute name of
this feature.
+     * @throws ClassCastException If the value is not assignable to the expected value class.
      * @throws RuntimeException If this method performs validation and the given value does
not meet the conditions.
      *         <span style="color:firebrick">This exception will be changed to {@code
IllegalAttributeException} in
      *         a future SIS version.</span>
      *
      * @see DefaultAttribute#setValue(Object)
      */
-    public void setAttributeValue(final String name, final Object value) throws IllegalArgumentException
{
-        Object element = properties.get(name);
-        if (element == null) {
-            final DefaultAttributeType<?> at = type.getProperty(name);
-            if (at == null) {
-                throw new IllegalArgumentException(propertyNotFound(name));
-            }
-            if (Objects.equals(value, at.getDefaultValue())) {
-                return; // Avoid creating the attribute if not necessary.
-            }
-            final DefaultAttribute<?> attribute = new DefaultAttribute<>(at);
-            setAttributeValue(attribute, value);
-            if (properties.put(name, attribute) != null) {
-                throw new ConcurrentModificationException(name);
-            }
-        } else {
-            // TODO: check for PropertyList list here.
-            if (element instanceof DefaultAttribute<?>) {
-                setAttributeValue((DefaultAttribute<?>) element, value);
-            } else {
-                if (properties.put(name, value) != element) {
-                    throw new ConcurrentModificationException(name);
+    public void setPropertyValue(final String name, final Object value) throws IllegalArgumentException
{
+        ArgumentChecks.ensureNonNull("name", name);
+        if (!asPropertyInstances) {
+            final Object previous = properties.put(name, value);
+            /*
+             * Slight optimisation: if we replaced a previous value of the same class, then
we can skip the
+             * checks for name and type validity since those checks has been done previously.
But if we add
+             * a new value or a value of a different type, then we need to check the name
and type validity.
+             */
+            if (previous == null || (value != null && previous.getClass() != value.getClass()))
{
+                final DefaultAttributeType<?> pt = type.getProperty(name);
+                if (pt == null || (value != null && !pt.getValueClass().isInstance(value)))
{
+                    replace(name, value, previous); // Restore the previous value.
+                    if (pt == null) {
+                        throw new IllegalArgumentException(Errors.format(
+                                Errors.Keys.PropertyNotFound_2, type.getName(), name));
+                    } else {
+                        throw new ClassCastException(Errors.format(
+                                Errors.Keys.IllegalPropertyClass_2, name, value.getClass()));
+                    }
                 }
             }
+        } else {
+            setAttributeValue(getPropertyInstance(name), value);
         }
     }
 
     /**
-     * Sets the attribute value after verification of its type.
+     * Sets a value in the {@link #properties} map.
+     *
+     * @param name     The name of the property to set.
+     * @param oldValue The old value, used for verification purpose.
+     * @param newValue The new value.
+     */
+    private void replace(final String name, final Object oldValue, final Object newValue)
{
+        if (properties.put(name, newValue) != oldValue) {
+            throw new ConcurrentModificationException(name);
+        }
+    }
+
+    /**
+     * Sets the attribute value after verification of its type. This method is invoked only
for checking
+     * that we are not violating the Java parameterized type contract. For a more exhaustive
validation,
+     * use {@link Validator} instead.
      */
     @SuppressWarnings("unchecked")
     private static <T> void setAttributeValue(final DefaultAttribute<T> attribute,
final Object value) {
         if (value != null) {
-            final DefaultAttributeType<T> at = attribute.getType();
-            if (!at.getValueClass().isInstance(value)) {
-                throw new RuntimeException( // TODO: use IllegalAttributeException after
GeoAPI revision.
-                        Errors.format(Errors.Keys.IllegalPropertyClass_2, at.getName(), value.getClass()));
+            final DefaultAttributeType<T> pt = attribute.getType();
+            if (!pt.getValueClass().isInstance(value)) {
+                throw new ClassCastException(Errors.format(Errors.Keys.IllegalPropertyClass_2,
+                        pt.getName(), value.getClass()));
             }
         }
         ((DefaultAttribute) attribute).setValue(value);
     }
 
     /**
-     * Returns the error message for a property not found.
-     */
-    private String propertyNotFound(final String name) {
-        return Errors.format(Errors.Keys.PropertyNotFound_2, type.getName(), name);
-    }
-
-    /**
      * Ensures that all current properties comply with the constraints defined by the feature
type.
      * This method will implicitly invokes {@link DefaultAttribute#validate()} for all attributes.
      *
@@ -307,8 +313,7 @@ public class DefaultFeature implements S
         for (final Map.Entry<String,Object> entry : properties.entrySet()) {
             final DefaultAttributeType<?> at;
             Object element = entry.getValue();
-            // TODO: check for PropertyList list here.
-            if (element instanceof DefaultAttribute<?>) {
+            if (asPropertyInstances) {
                 at = ((DefaultAttribute<?>) element).getType();
                 element = ((DefaultAttribute<?>) element).getValue();
             } else {

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=1593149&r1=1593148&r2=1593149&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] Wed May  7 22:31:28 2014
@@ -42,6 +42,17 @@ import org.apache.sis.internal.util.Unmo
  * Compared to the Java language, {@code FeatureType} is equivalent to {@link Class} while
  * {@code Feature} instances are equivalent to {@link Object} instances of that class.</div>
  *
+ * A feature type can inherit the properties of one or more other feature types.
+ * Each feature type can provide descriptions for the following properties:
+ *
+ * <ul>
+ *   <li>{@linkplain DefaultAttributeType   Attributes}</li>
+ *   <li>{@linkplain DefaultAssociationRole Associations to other feature types}</li>
+ *   <li>{@linkplain DefaultOperationType   Operations}</li>
+ * </ul>
+ *
+ * The description of all those properties are collectively called {@linkplain #characteristics()
characteristics}.
+ *
  * <div class="warning"><b>Warning:</b>
  * This class is expected to implement a GeoAPI {@code FeatureType} interface in a future
version.
  * When such interface will be available, most references to {@code DefaultFeatureType} in
the API
@@ -124,6 +135,10 @@ public class DefaultFeatureType extends 
      *   </tr>
      * </table>
      *
+     * <div class="warning"><b>Warning:</b> In a future SIS version, the
type of array elements may be
+     * changed to {@code org.opengis.feature.FeatureType} {@code org.opengis.feature.PropertyType}.
+     * This change is pending GeoAPI revision.</div>
+     *
      * @param properties The name and other properties to be given to this feature type.
      * @param isAbstract If {@code true}, the feature type acts as an abstract super-type.
      * @param superTypes The parents of this feature type, or {@code null} or empty if none.
@@ -202,6 +217,10 @@ public class DefaultFeatureType extends 
     /**
      * Returns the parents of this feature type.
      *
+     * <div class="warning"><b>Warning:</b>
+     * The type of list elements will be changed to {@code FeatureType} if and when such
interface
+     * will be defined in GeoAPI.</div>
+     *
      * @return The parents of this feature type, or an empty set if none.
      */
     public Set<DefaultFeatureType> superTypes() {
@@ -218,7 +237,7 @@ public class DefaultFeatureType extends 
      *
      * @return Feature operation, attribute type and association role that carries characteristics
of a feature type.
      */
-    public List<DefaultAttributeType<?>> getCharacteristics() {
+    public List<DefaultAttributeType<?>> characteristics() {
         return characteristics;
     }
 

Modified: sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/package-info.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/package-info.java?rev=1593149&r1=1593148&r2=1593149&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/package-info.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/package-info.java
[UTF-8] Wed May  7 22:31:28 2014
@@ -51,7 +51,7 @@
  * {@code  ├─}     {@linkplain org.apache.sis.feature.DefaultFeatureType        Feature
type}<br>
  * {@code  └─}     {@linkplain org.apache.sis.feature.AbstractPropertyType      Property
type}<br>
  * {@code      ├─} {@linkplain org.apache.sis.feature.DefaultAttributeType     
Attribute type}<br>
- * {@code      ├─} {@linkplain org.apache.sis.feature.DefaultOperation         
Operation}<br>
+ * {@code      ├─} {@linkplain org.apache.sis.feature.DefaultOperationType     
Operation}<br>
  * {@code      └─} {@linkplain org.apache.sis.feature.DefaultFeatureAssociation
Feature association role}<br>
  * </td><td class="sep" style="width: 50%; white-space: nowrap">
  *             {@linkplain org.apache.sis.feature.DefaultFeature    Feature}<br>

Modified: sis/branches/JDK8/core/sis-feature/src/test/java/org/apache/sis/feature/DefaultFeatureTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-feature/src/test/java/org/apache/sis/feature/DefaultFeatureTest.java?rev=1593149&r1=1593148&r2=1593149&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-feature/src/test/java/org/apache/sis/feature/DefaultFeatureTest.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-feature/src/test/java/org/apache/sis/feature/DefaultFeatureTest.java
[UTF-8] Wed May  7 22:31:28 2014
@@ -44,12 +44,12 @@ public final strictfp class DefaultFeatu
     public void testSimple() {
         final DefaultFeature cityPopulation = new DefaultFeature(DefaultFeatureTypeTest.cityPopulation());
 
-        assertEquals("Utopia", cityPopulation.getAttributeValue("city"));
-        cityPopulation.setAttributeValue("city", "Atlantide");
-        assertEquals("Atlantide", cityPopulation.getAttributeValue("city"));
+        assertEquals("Utopia", cityPopulation.getPropertyValue("city"));
+        cityPopulation.setPropertyValue("city", "Atlantide");
+        assertEquals("Atlantide", cityPopulation.getPropertyValue("city"));
 
-        assertNull(cityPopulation.getAttributeValue("population"));
-        cityPopulation.setAttributeValue("population", 1000);
-        assertEquals(1000, cityPopulation.getAttributeValue("population"));
+        assertNull(cityPopulation.getPropertyValue("population"));
+        cityPopulation.setPropertyValue("population", 1000);
+        assertEquals(1000, cityPopulation.getPropertyValue("population"));
     }
 }

Modified: sis/branches/JDK8/core/sis-feature/src/test/java/org/apache/sis/feature/DefaultFeatureTypeTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-feature/src/test/java/org/apache/sis/feature/DefaultFeatureTypeTest.java?rev=1593149&r1=1593148&r2=1593149&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-feature/src/test/java/org/apache/sis/feature/DefaultFeatureTypeTest.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-feature/src/test/java/org/apache/sis/feature/DefaultFeatureTypeTest.java
[UTF-8] Wed May  7 22:31:28 2014
@@ -62,7 +62,7 @@ public final strictfp class DefaultFeatu
         /*
          * Verify content.
          */
-        final List<DefaultAttributeType<?>> characteristics = simple.getCharacteristics();
+        final List<DefaultAttributeType<?>> characteristics = simple.characteristics();
         assertEquals("characteristics.size", 2, characteristics.size());
         assertEquals("characteristics[0]", "city",       characteristics.get(0).getName().toString());
         assertEquals("characteristics[1]", "population", characteristics.get(1).getName().toString());

Modified: sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/storage/shapefile/ShapeFile.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/storage/shapefile/ShapeFile.java?rev=1593149&r1=1593148&r2=1593149&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/storage/shapefile/ShapeFile.java
[UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/storage/shapefile/ShapeFile.java
[UTF-8] Wed May  7 22:31:28 2014
@@ -162,7 +162,7 @@ public class ShapeFile {
                 double x = rf.getDouble();
                 double y = rf.getDouble();
                 Point pnt = new Point(x,y);
-                f.setAttributeValue(GEOMETRY_NAME, pnt);
+                f.setPropertyValue(GEOMETRY_NAME, pnt);
 
             } else if (ShapeType == ShapeTypeEnum.Polygon.getValue()) {
                 double xmin = rf.getDouble();
@@ -190,7 +190,7 @@ public class ShapeFile {
                     ypnt = rf.getDouble();
                     poly.lineTo(xpnt, ypnt);
                 }
-                f.setAttributeValue(GEOMETRY_NAME, poly);
+                f.setPropertyValue(GEOMETRY_NAME, poly);
 
             } else if (ShapeType == ShapeTypeEnum.PolyLine.getValue()) {
                 double xmin = rf.getDouble();
@@ -226,7 +226,7 @@ public class ShapeFile {
                     }
                 }
 
-                f.setAttributeValue(GEOMETRY_NAME, ply);
+                f.setPropertyValue(GEOMETRY_NAME, ply);
 
             } else {
                 throw new DataStoreException("Unsupported shapefile type: " + this.ShapeType);
@@ -243,7 +243,7 @@ public class ShapeFile {
                 data = new byte[fd.getLength()];
                 df.get(data);
                 String value = new String(data);
-                f.setAttributeValue(fd.getName(), value);
+                f.setPropertyValue(fd.getName(), value);
             }
 
             this.FeatureMap.put(RecordNumber, f);



Mime
View raw message