sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1597747 - in /sis/branches/JDK8/core: sis-feature/src/main/java/org/apache/sis/feature/ sis-feature/src/test/java/org/apache/sis/feature/ sis-metadata/src/test/java/org/apache/sis/metadata/iso/ sis-utility/src/main/java/org/apache/sis/meas...
Date Tue, 27 May 2014 11:19:25 GMT
Author: desruisseaux
Date: Tue May 27 11:19:24 2014
New Revision: 1597747

URL: http://svn.apache.org/r1597747
Log:
Use GeoAPI FeatureType interface. Like the previous commit for PropertyType, this is branch-specific.

Modified:
    sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/AbstractAssociation.java
    sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/AbstractAttribute.java
    sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/AbstractFeature.java
    sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/DefaultAssociationRole.java
    sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/DefaultAttributeType.java
    sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/DefaultFeatureType.java
    sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/DefaultOperation.java
    sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/FeatureFormat.java
    sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/Features.java
    sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/FieldType.java
    sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/MultiValuedAttribute.java
    sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/SingletonAttribute.java
    sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/Validator.java
    sis/branches/JDK8/core/sis-feature/src/test/java/org/apache/sis/feature/CustomAttribute.java
    sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/AllMetadataTest.java
    sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/measure/NumberRange.java

Modified: sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/AbstractAssociation.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/AbstractAssociation.java?rev=1597747&r1=1597746&r2=1597747&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/AbstractAssociation.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/AbstractAssociation.java
[UTF-8] Tue May 27 11:19:24 2014
@@ -224,7 +224,7 @@ public abstract class AbstractAssociatio
     public String toString() {
         final String pt = role.getTitleProperty();
         final Iterator<AbstractFeature> it = getValues().iterator();
-        return role.toString("FeatureAssociation", role.getValueType().getName(), new Iterator<Object>()
{
+        return FieldType.toString("FeatureAssociation", role, role.getValueType().getName(),
new Iterator<Object>() {
             @Override public boolean hasNext() {
                 return it.hasNext();
             }

Modified: sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/AbstractAttribute.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/AbstractAttribute.java?rev=1597747&r1=1597746&r2=1597747&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/AbstractAttribute.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/AbstractAttribute.java
[UTF-8] Tue May 27 11:19:24 2014
@@ -25,6 +25,9 @@ import org.apache.sis.util.Debug;
 import org.apache.sis.util.Classes;
 import org.apache.sis.util.ArgumentChecks;
 
+// Branch-dependent imports
+import org.opengis.feature.AttributeType;
+
 
 /**
  * An instance of an {@linkplain DefaultAttributeType attribute type} containing the value
of an attribute in a feature.
@@ -64,16 +67,16 @@ public abstract class AbstractAttribute<
     /**
      * Information about the attribute (base Java class, domain of values, <i>etc.</i>).
      */
-    final DefaultAttributeType<V> type;
+    final AttributeType<V> type;
 
     /**
      * Creates a new attribute of the given type.
      *
      * @param type Information about the attribute (base Java class, domain of values, <i>etc.</i>).
      *
-     * @see #create(DefaultAttributeType)
+     * @see #create(AttributeType)
      */
-    protected AbstractAttribute(final DefaultAttributeType<V> type) {
+    protected AbstractAttribute(final AttributeType<V> type) {
         this.type = type;
     }
 
@@ -85,7 +88,7 @@ public abstract class AbstractAttribute<
      * @param  type Information about the attribute (base Java class, domain of values, <i>etc.</i>).
      * @return The new attribute.
      */
-    public static <V> AbstractAttribute<V> create(final DefaultAttributeType<V>
type) {
+    public static <V> AbstractAttribute<V> create(final AttributeType<V>
type) {
         ArgumentChecks.ensureNonNull("type", type);
         return isSingleton(type.getMaximumOccurs())
                ? new SingletonAttribute<>(type)
@@ -101,7 +104,7 @@ public abstract class AbstractAttribute<
      * @param  value The initial value (may be {@code null}).
      * @return The new attribute.
      */
-    static <V> AbstractAttribute<V> create(final DefaultAttributeType<V>
type, final Object value) {
+    static <V> AbstractAttribute<V> create(final AttributeType<V> type,
final Object value) {
         ArgumentChecks.ensureNonNull("type", type);
         return isSingleton(type.getMaximumOccurs())
                ? new SingletonAttribute<>(type, value)
@@ -110,7 +113,7 @@ public abstract class AbstractAttribute<
 
     /**
      * Returns the name of this attribute as defined by its {@linkplain #getType() type}.
-     * This convenience method delegates to {@link DefaultAttributeType#getName()}.
+     * This convenience method delegates to {@link AttributeType#getName()}.
      *
      * @return The attribute name specified by its type.
      */
@@ -122,12 +125,9 @@ public abstract class AbstractAttribute<
     /**
      * Returns information about the attribute (base Java class, domain of values, <i>etc.</i>).
      *
-     * <div class="warning"><b>Warning:</b> In a future SIS version, the
return type may be changed
-     * to {@code org.opengis.feature.AttributeType}. This change is pending GeoAPI revision.</div>
-     *
      * @return Information about the attribute.
      */
-    public DefaultAttributeType<V> getType() {
+    public AttributeType<V> getType() {
         return type;
     }
 
@@ -271,6 +271,6 @@ public abstract class AbstractAttribute<
     @Debug
     @Override
     public String toString() {
-        return type.toString("Attribute", Classes.getShortName(type.getValueClass()), getValues().iterator());
+        return FieldType.toString("Attribute", type, Classes.getShortName(type.getValueClass()),
getValues().iterator());
     }
 }

Modified: sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/AbstractFeature.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/AbstractFeature.java?rev=1597747&r1=1597746&r2=1597747&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/AbstractFeature.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/AbstractFeature.java
[UTF-8] Tue May 27 11:19:24 2014
@@ -30,6 +30,7 @@ import org.apache.sis.internal.util.Chec
 
 // Branch-dependent imports
 import org.opengis.feature.PropertyType;
+import org.opengis.feature.AttributeType;
 
 
 /**
@@ -186,8 +187,8 @@ public abstract class AbstractFeature im
      */
     final Property createProperty(final String name, final Object value) {
         final PropertyType pt = getPropertyType(name);
-        if (pt instanceof DefaultAttributeType<?>) {
-            return AbstractAttribute.create((DefaultAttributeType<?>) pt, value);
+        if (pt instanceof AttributeType<?>) {
+            return AbstractAttribute.create((AttributeType<?>) pt, value);
         } else if (pt instanceof DefaultAssociationRole) {
             return AbstractAssociation.create((DefaultAssociationRole) pt, value);
         } else {
@@ -205,8 +206,8 @@ public abstract class AbstractFeature im
      */
     final Property createProperty(final String name) throws IllegalArgumentException {
         final PropertyType pt = getPropertyType(name);
-        if (pt instanceof DefaultAttributeType<?>) {
-            return AbstractAttribute.create((DefaultAttributeType<?>) pt);
+        if (pt instanceof AttributeType<?>) {
+            return AbstractAttribute.create((AttributeType<?>) pt);
         } else if (pt instanceof DefaultAssociationRole) {
             return AbstractAssociation.create((DefaultAssociationRole) pt);
         } else {
@@ -224,8 +225,8 @@ public abstract class AbstractFeature im
      */
     final Object getDefaultValue(final String name) throws IllegalArgumentException {
         final PropertyType pt = getPropertyType(name);
-        if (pt instanceof DefaultAttributeType<?>) {
-            return getDefaultValue((DefaultAttributeType<?>) pt);
+        if (pt instanceof AttributeType<?>) {
+            return getDefaultValue((AttributeType<?>) pt);
         } else if (pt instanceof DefaultAssociationRole) {
             return null; // No default value for associations.
         } else {
@@ -236,7 +237,7 @@ public abstract class AbstractFeature im
     /**
      * Returns the default value to be returned by {@link #getPropertyValue(String)} for
the given attribute type.
      */
-    private static <V> Object getDefaultValue(final DefaultAttributeType<V> attribute)
{
+    private static <V> Object getDefaultValue(final AttributeType<V> attribute)
{
         final V defaultValue = attribute.getDefaultValue();
         if (Field.isSingleton(attribute.getMaximumOccurs())) {
             return defaultValue;
@@ -327,7 +328,7 @@ public abstract class AbstractFeature im
     @SuppressWarnings("unchecked")
     private static <V> void setAttributeValue(final AbstractAttribute<V> attribute,
final Object value) {
         if (value != null) {
-            final DefaultAttributeType<V> pt = attribute.getType();
+            final AttributeType<V> pt = attribute.getType();
             final Class<?> base = pt.getValueClass();
             if (!base.isInstance(value)) {
                 Object element = value;
@@ -422,9 +423,9 @@ public abstract class AbstractFeature im
      */
     final Object verifyPropertyValue(final String name, final Object value) {
         final PropertyType pt = getPropertyType(name);
-        if (pt instanceof DefaultAttributeType<?>) {
+        if (pt instanceof AttributeType<?>) {
             if (value != null) {
-                return verifyAttributeValue((DefaultAttributeType<?>) pt, value);
+                return verifyAttributeValue((AttributeType<?>) pt, value);
             }
         } else if (pt instanceof DefaultAssociationRole) {
             if (value != null) {
@@ -446,7 +447,7 @@ public abstract class AbstractFeature im
      *
      * @param value The value, which shall be non-null.
      */
-    private static <T> Object verifyAttributeValue(final DefaultAttributeType<T>
type, final Object value) {
+    private static <T> Object verifyAttributeValue(final AttributeType<T> type,
final Object value) {
         final Class<T> valueClass = type.getValueClass();
         final boolean isSingleton = Field.isSingleton(type.getMaximumOccurs());
         if (valueClass.isInstance(value)) {

Modified: sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/DefaultAssociationRole.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/DefaultAssociationRole.java?rev=1597747&r1=1597746&r2=1597747&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/DefaultAssociationRole.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/DefaultAssociationRole.java
[UTF-8] Tue May 27 11:19:24 2014
@@ -25,6 +25,7 @@ import static org.apache.sis.util.Argume
 
 // Branch-dependent imports
 import org.opengis.feature.PropertyType;
+import org.opengis.feature.AttributeType;
 
 
 /**
@@ -142,8 +143,8 @@ public class DefaultAssociationRole exte
         if (p == null) {
             p = "";
             for (final PropertyType type : valueType.getProperties(true)) {
-                if (type instanceof DefaultAttributeType<?>) {
-                    final DefaultAttributeType<?> pt = (DefaultAttributeType<?>)
type;
+                if (type instanceof AttributeType<?>) {
+                    final AttributeType<?> pt = (AttributeType<?>) type;
                     if (pt.getMaximumOccurs() != 0 && CharSequence.class.isAssignableFrom(pt.getValueClass()))
{
                         p = pt.getName().toString();
                         break;
@@ -215,6 +216,6 @@ public class DefaultAssociationRole exte
     @Debug
     @Override
     public String toString() {
-        return toString("FeatureAssociationRole", valueType.getName()).toString();
+        return toString("FeatureAssociationRole", this, valueType.getName()).toString();
     }
 }

Modified: sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/DefaultAttributeType.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/DefaultAttributeType.java?rev=1597747&r1=1597746&r2=1597747&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/DefaultAttributeType.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/DefaultAttributeType.java
[UTF-8] Tue May 27 11:19:24 2014
@@ -25,8 +25,9 @@ import org.apache.sis.internal.util.Nume
 
 import static org.apache.sis.util.ArgumentChecks.*;
 
-// Related to JDK7
+// Branch-dependent imports
 import java.util.Objects;
+import org.opengis.feature.AttributeType;
 
 
 /**
@@ -39,11 +40,6 @@ import java.util.Objects;
  * Compared to the Java language, {@code AttributeType} is equivalent to {@link java.lang.reflect.Field}
  * while {@code FeatureType} is equivalent to {@link Class}.</div>
  *
- * <div class="warning"><b>Warning:</b>
- * This class is expected to implement a GeoAPI {@code AttributeType} interface in a future
version.
- * When such interface will be available, most references to {@code DefaultAttributeType}
in current
- * API will be replaced by references to the {@code AttributeType} interface.</div>
- *
  * {@section Value type}
  * Attributes can be used for both spatial and non-spatial properties.
  * Some examples are:
@@ -75,7 +71,7 @@ import java.util.Objects;
  *
  * @see AbstractAttribute
  */
-public class DefaultAttributeType<V> extends FieldType {
+public class DefaultAttributeType<V> extends FieldType implements AttributeType<V>
{
     /**
      * For cross-version compatibility.
      */
@@ -151,6 +147,7 @@ public class DefaultAttributeType<V> ext
      *
      * @return The type of attribute values.
      */
+    @Override
     public final Class<V> getValueClass() {
         return valueClass;
     }
@@ -202,6 +199,7 @@ public class DefaultAttributeType<V> ext
      *
      * @return The default value for the attribute, or {@code null} if none.
      */
+    @Override
     public V getDefaultValue() {
         return defaultValue;
     }
@@ -243,6 +241,6 @@ public class DefaultAttributeType<V> ext
     @Debug
     @Override
     public String toString() {
-        return toString("AttributeType", Classes.getShortName(valueClass)).toString();
+        return toString("AttributeType", this, Classes.getShortName(valueClass)).toString();
     }
 }

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=1597747&r1=1597746&r2=1597747&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/DefaultFeatureType.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/DefaultFeatureType.java
[UTF-8] Tue May 27 11:19:24 2014
@@ -38,6 +38,7 @@ import org.apache.sis.internal.util.Unmo
 
 // Branch-dependent imports
 import org.opengis.feature.PropertyType;
+import org.opengis.feature.AttributeType;
 
 
 /**
@@ -263,9 +264,9 @@ public class DefaultFeatureType extends 
         for (final Map.Entry<String,PropertyType> entry : byName.entrySet()) {
             final int minimumOccurs, maximumOccurs;
             final PropertyType property = entry.getValue();
-            if (property instanceof DefaultAttributeType<?>) { // TODO: check for AttributeType
instead (after GeoAPI upgrade).
-                minimumOccurs = ((DefaultAttributeType<?>) property).getMinimumOccurs();
-                maximumOccurs = ((DefaultAttributeType<?>) property).getMaximumOccurs();
+            if (property instanceof AttributeType<?>) {
+                minimumOccurs = ((AttributeType<?>) property).getMinimumOccurs();
+                maximumOccurs = ((AttributeType<?>) property).getMaximumOccurs();
                 isSimple &= (minimumOccurs == maximumOccurs);
             } else if (property instanceof FieldType) { // TODO: check for AssociationRole
instead (after GeoAPI upgrade).
                 minimumOccurs = ((FieldType) property).getMinimumOccurs();
@@ -475,15 +476,15 @@ public class DefaultFeatureType extends 
     {
         if (base != other) {
             /*
-             * TODO: DefaultAttributeType and DefaultAssociationRole to be replaced by GeoAPI
interfaces
+             * TODO: DefaultAssociationRole to be replaced by GeoAPI interfaces
              *       (pending GeoAPI review).
              */
-            if (base instanceof DefaultAttributeType<?>) {
-                if (!(other instanceof DefaultAttributeType<?>)) {
+            if (base instanceof AttributeType<?>) {
+                if (!(other instanceof AttributeType<?>)) {
                     return false;
                 }
-                final DefaultAttributeType<?> p0 = (DefaultAttributeType<?>)
base;
-                final DefaultAttributeType<?> p1 = (DefaultAttributeType<?>)
other;
+                final AttributeType<?> p0 = (AttributeType<?>) base;
+                final AttributeType<?> p1 = (AttributeType<?>) other;
                 if (!p0.getValueClass().isAssignableFrom(p1.getValueClass()) ||
                      p0.getMinimumOccurs() > p1.getMinimumOccurs() ||
                      p0.getMaximumOccurs() < p1.getMaximumOccurs())

Modified: sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/DefaultOperation.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/DefaultOperation.java?rev=1597747&r1=1597746&r2=1597747&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/DefaultOperation.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/DefaultOperation.java
[UTF-8] Tue May 27 11:19:24 2014
@@ -27,6 +27,7 @@ import org.apache.sis.util.Debug;
 // Branch-dependent imports
 import java.util.Objects;
 import org.opengis.feature.PropertyType;
+import org.opengis.feature.AttributeType;
 
 
 /**
@@ -63,7 +64,7 @@ public class DefaultOperation extends Ab
     /**
      * The type of the result, or {@code null} if none.
      */
-    private final DefaultAttributeType<?> result;
+    private final AttributeType<?> result;
 
     /**
      * Constructs an operation from the given properties. The identification map is given
unchanged to
@@ -74,7 +75,7 @@ public class DefaultOperation extends Ab
      * @param result         The type of the result, or {@code null} if none.
      */
     public DefaultOperation(final Map<String,?> identification,
-            final ParameterDescriptorGroup parameters, final DefaultAttributeType<?>
result)
+            final ParameterDescriptorGroup parameters, final AttributeType<?> result)
     {
         super(identification);
         ArgumentChecks.ensureNonNull("parameters", parameters);
@@ -96,7 +97,7 @@ public class DefaultOperation extends Ab
      *
      * @return The type of the result, or {@code null} if none.
      */
-    public DefaultAttributeType<?> getResult() {
+    public AttributeType<?> getResult() {
         return result;
     }
 

Modified: sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/FeatureFormat.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/FeatureFormat.java?rev=1597747&r1=1597746&r2=1597747&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/FeatureFormat.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/FeatureFormat.java
[UTF-8] Tue May 27 11:19:24 2014
@@ -34,6 +34,7 @@ import org.apache.sis.util.resources.Voc
 
 // Branch-dependent imports
 import org.opengis.feature.PropertyType;
+import org.opengis.feature.AttributeType;
 
 
 /**
@@ -196,8 +197,8 @@ header: for (int i=0; ; i++) {
                         continue; // If no value, skip the full row.
                     }
                 }
-            } else if (propertyType instanceof DefaultAttributeType<?>) {
-                value = ((DefaultAttributeType<?>) propertyType).getDefaultValue();
+            } else if (propertyType instanceof AttributeType<?>) {
+                value = ((AttributeType<?>) propertyType).getDefaultValue();
             } else {
                 value = null;
             }
@@ -212,8 +213,8 @@ header: for (int i=0; ; i++) {
             final String   valueType;
             final Class<?> valueClass;
             final int minimumOccurs, maximumOccurs;
-            if (propertyType instanceof DefaultAttributeType<?>) {
-                final DefaultAttributeType<?> pt = (DefaultAttributeType<?>)
propertyType;
+            if (propertyType instanceof AttributeType<?>) {
+                final AttributeType<?> pt = (AttributeType<?>) propertyType;
                 minimumOccurs = pt.getMinimumOccurs();
                 maximumOccurs = pt.getMaximumOccurs();
                 valueClass    = pt.getValueClass();
@@ -226,7 +227,7 @@ header: for (int i=0; ; i++) {
                 valueType     = toString(pt.getValueType().getName());
                 valueClass    = AbstractFeature.class;
             } else if (propertyType instanceof DefaultOperation) {
-                final DefaultAttributeType<?> resultType = ((DefaultOperation) propertyType).getResult();
+                final AttributeType<?> resultType = ((DefaultOperation) propertyType).getResult();
                 valueType   = toString(resultType.getName());
                 valueClass  = null;
                 minimumOccurs = -1;

Modified: sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/Features.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/Features.java?rev=1597747&r1=1597746&r2=1597747&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/Features.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/Features.java
[UTF-8] Tue May 27 11:19:24 2014
@@ -19,6 +19,9 @@ package org.apache.sis.feature;
 import org.apache.sis.util.Static;
 import org.apache.sis.util.resources.Errors;
 
+// Branch-dependent imports
+import org.opengis.feature.AttributeType;
+
 
 /**
  * Static methods working on features.
@@ -49,7 +52,7 @@ public final class Features extends Stat
      * @category verification
      */
     @SuppressWarnings("unchecked")
-    public static <V> DefaultAttributeType<V> cast(final DefaultAttributeType<?>
type, final Class<V> valueClass)
+    public static <V> AttributeType<V> cast(final AttributeType<?> type,
final Class<V> valueClass)
             throws ClassCastException
     {
         if (type != null) {
@@ -61,7 +64,7 @@ public final class Features extends Stat
                         type.getName(), valueClass, actual));
             }
         }
-        return (DefaultAttributeType<V>) type;
+        return (AttributeType<V>) type;
     }
 
     /**

Modified: sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/FieldType.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/FieldType.java?rev=1597747&r1=1597746&r2=1597747&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/FieldType.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/FieldType.java
[UTF-8] Tue May 27 11:19:24 2014
@@ -127,12 +127,16 @@ abstract class FieldType extends Abstrac
      * Example:
      *
      * {@preformat text
-     *     FooType[“name” : ValueClass]
+     *     PropertyType[“name” : ValueClass]
      * }
+     *
+     * @param className The interface name of the object on which {@code toString()} is invoked.
+     * @param type      The property type, sometime {@code this} or sometime an other object.
+     * @param valueType The name of value class (attribute), or the feature type name (association).
      */
-    final StringBuilder toString(final String typeName, final Object valueName) {
-        final StringBuilder buffer = new StringBuilder(40).append(typeName).append('[');
-        final GenericName name = getName();
+    static StringBuilder toString(final String className, final PropertyType type, final
Object valueType) {
+        final StringBuilder buffer = new StringBuilder(40).append(className).append('[');
+        final GenericName name = type.getName();
         if (name != null) {
             buffer.append('“');
         }
@@ -140,7 +144,7 @@ abstract class FieldType extends Abstrac
         if (name != null) {
             buffer.append("” : ");
         }
-        return buffer.append(valueName).append(']');
+        return buffer.append(valueType).append(']');
     }
 
     /**
@@ -148,11 +152,16 @@ abstract class FieldType extends Abstrac
      * Example:
      *
      * {@preformat text
-     *     FooType[“name” : ValueClass] = {value1, value2, ...}
+     *     Property[“name” : ValueClass] = {value1, value2, ...}
      * }
+     *
+     * @param className The interface name of the object on which {@code toString()} is invoked.
+     * @param type      The property type associated to the object to format.
+     * @param valueType The name of value class (attribute), or the feature type name (association).
+     * @param values    The actual values.
      */
-    final String toString(final String typeName, final Object valueName, final Iterator<?>
values) {
-        final StringBuilder buffer = toString(typeName, valueName);
+    static String toString(final String className, final PropertyType type, final Object
valueType, final Iterator<?> values) {
+        final StringBuilder buffer = toString(className, type, valueType);
         if (values.hasNext()) {
             final Object value = values.next();
             final boolean isMultiValued = values.hasNext();

Modified: sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/MultiValuedAttribute.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/MultiValuedAttribute.java?rev=1597747&r1=1597746&r2=1597747&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/MultiValuedAttribute.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/MultiValuedAttribute.java
[UTF-8] Tue May 27 11:19:24 2014
@@ -21,6 +21,9 @@ import org.apache.sis.internal.util.Chec
 import org.apache.sis.util.ArgumentChecks;
 import org.apache.sis.util.resources.Errors;
 
+// Branch-dependent imports
+import org.opengis.feature.AttributeType;
+
 
 /**
  * An instance of an {@linkplain DefaultAttributeType attribute type} containing an arbitrary
amount of values.
@@ -64,7 +67,7 @@ final class MultiValuedAttribute<V> exte
      *
      * @param type Information about the attribute (base Java class, domain of values, <i>etc.</i>).
      */
-    public MultiValuedAttribute(final DefaultAttributeType<V> type) {
+    public MultiValuedAttribute(final AttributeType<V> type) {
         super(type);
         values = new CheckedArrayList<>(type.getValueClass());
         final V value = type.getDefaultValue();
@@ -81,7 +84,7 @@ final class MultiValuedAttribute<V> exte
      * @param values The initial values, or {@code null} for initializing to an empty list.
      */
     @SuppressWarnings("unchecked")
-    MultiValuedAttribute(final DefaultAttributeType<V> type, final Object values) {
+    MultiValuedAttribute(final AttributeType<V> type, final Object values) {
         super(type);
         final Class<V> valueClass = type.getValueClass();
         if (values == null) {

Modified: sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/SingletonAttribute.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/SingletonAttribute.java?rev=1597747&r1=1597746&r2=1597747&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/SingletonAttribute.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/SingletonAttribute.java
[UTF-8] Tue May 27 11:19:24 2014
@@ -16,8 +16,9 @@
  */
 package org.apache.sis.feature;
 
-// Related to JDK7
+// Branch-dependent imports
 import java.util.Objects;
+import org.opengis.feature.AttributeType;
 
 
 /**
@@ -59,7 +60,7 @@ final class SingletonAttribute<V> extend
      *
      * @param type Information about the attribute (base Java class, domain of values, <i>etc.</i>).
      */
-    public SingletonAttribute(final DefaultAttributeType<V> type) {
+    public SingletonAttribute(final AttributeType<V> type) {
         super(type);
         assert isSingleton(type.getMaximumOccurs());
         value = type.getDefaultValue();
@@ -72,7 +73,7 @@ final class SingletonAttribute<V> extend
      * @param type  Information about the attribute (base Java class, domain of values, <i>etc.</i>).
      * @param value The initial value (may be {@code null}).
      */
-    SingletonAttribute(final DefaultAttributeType<V> type, final Object value) {
+    SingletonAttribute(final AttributeType<V> type, final Object value) {
         super(type);
         assert isSingleton(type.getMaximumOccurs());
         this.value = type.getValueClass().cast(value);

Modified: sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/Validator.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/Validator.java?rev=1597747&r1=1597746&r2=1597747&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/Validator.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/Validator.java
[UTF-8] Tue May 27 11:19:24 2014
@@ -33,6 +33,7 @@ import org.apache.sis.util.resources.Err
 
 // Branch-dependent imports
 import org.opengis.feature.PropertyType;
+import org.opengis.feature.AttributeType;
 
 
 /**
@@ -110,9 +111,9 @@ final class Validator {
      * This method delegates to one of the {@code validate(…)} methods depending of the
value type.
      */
     void validateAny(final PropertyType type, final Object value) {
-        if (type instanceof DefaultAttributeType<?>) {
-            validate((DefaultAttributeType<?>) type, asList(value,
-                    ((DefaultAttributeType<?>) type).getMaximumOccurs()));
+        if (type instanceof AttributeType<?>) {
+            validate((AttributeType<?>) type, asList(value,
+                    ((AttributeType<?>) type).getMaximumOccurs()));
         }
         if (type instanceof DefaultAssociationRole) {
             validate((DefaultAssociationRole) type, asList(value,
@@ -123,7 +124,7 @@ final class Validator {
     /**
      * Verifies if the given values are valid for the given attribute type.
      */
-    void validate(final DefaultAttributeType<?> type, final Collection<?> values)
{
+    void validate(final AttributeType<?> type, final Collection<?> values) {
         AbstractElement report = null;
         for (final Object value : values) {
             /*

Modified: sis/branches/JDK8/core/sis-feature/src/test/java/org/apache/sis/feature/CustomAttribute.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-feature/src/test/java/org/apache/sis/feature/CustomAttribute.java?rev=1597747&r1=1597746&r2=1597747&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-feature/src/test/java/org/apache/sis/feature/CustomAttribute.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-feature/src/test/java/org/apache/sis/feature/CustomAttribute.java
[UTF-8] Tue May 27 11:19:24 2014
@@ -25,6 +25,9 @@ import org.apache.sis.referencing.NamedI
 
 import static org.junit.Assert.*;
 
+// Branch-dependent imports
+import org.opengis.feature.AttributeType;
+
 
 /**
  * For testing {@link AbstractAttribute} customization.
@@ -50,7 +53,7 @@ final strictfp class CustomAttribute<V> 
     /**
      * Creates a new attribute.
      */
-    public CustomAttribute(final DefaultAttributeType<V> type) {
+    public CustomAttribute(final AttributeType<V> type) {
         super(type);
         value = type.getDefaultValue();
     }

Modified: sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/AllMetadataTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/AllMetadataTest.java?rev=1597747&r1=1597746&r2=1597747&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/AllMetadataTest.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/AllMetadataTest.java
[UTF-8] Tue May 27 11:19:24 2014
@@ -152,7 +152,7 @@ public final strictfp class AllMetadataT
             org.opengis.metadata.maintenance.MaintenanceFrequency.class,
             org.opengis.metadata.maintenance.MaintenanceInformation.class,
             org.opengis.metadata.maintenance.ScopeCode.class,
-            org.opengis.metadata.maintenance.ScopeDescription.class,
+//          org.opengis.metadata.maintenance.ScopeDescription.class,  // Excluded because
of deprecated FeatureType.
             org.opengis.metadata.quality.AbsoluteExternalPositionalAccuracy.class,
             org.opengis.metadata.quality.AccuracyOfATimeMeasurement.class,
             org.opengis.metadata.quality.Completeness.class,
@@ -201,7 +201,7 @@ public final strictfp class AllMetadataT
     }
 
     /**
-     * Performs the test documente in the {@link MetadataTestCase} javadoc.
+     * Performs the test documented in the {@link MetadataTestCase} javadoc.
      */
     @Test
     @Override

Modified: sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/measure/NumberRange.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/measure/NumberRange.java?rev=1597747&r1=1597746&r2=1597747&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/measure/NumberRange.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/measure/NumberRange.java
[UTF-8] Tue May 27 11:19:24 2014
@@ -73,9 +73,8 @@ import org.apache.sis.util.collection.We
  *
  * <p>All {@code create} static methods may return a shared instance. Those methods
are preferred
  * to the constructors when the range is expected to have a long lifetime, typically as instance
- * given to {@linkplain org.apache.sis.parameter.DefaultParameterDescriptor parameter descriptor}
- * or {@linkplain org.apache.sis.feature.DefaultAttributeType attribute type} constructor.
Other
- * methods do not check for shared instances, since the created object is often temporary.</p>
+ * given to {@linkplain org.apache.sis.parameter.DefaultParameterDescriptor parameter descriptor}.
+ * Other methods do not check for shared instances, since the created object is often temporary.</p>
  *
  * @param <E> The type of range elements as a subclass of {@link Number}.
  *



Mime
View raw message