sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1609865 [2/2] - in /sis/branches/JDK6: ./ core/sis-feature/src/main/java/org/apache/sis/feature/ core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/code/ core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ core/sis-...
Date Fri, 11 Jul 2014 23:13:08 GMT
Modified: sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultRecordType.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultRecordType.java?rev=1609865&r1=1609864&r2=1609865&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultRecordType.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultRecordType.java [UTF-8] Fri Jul 11 23:13:07 2014
@@ -18,20 +18,29 @@ package org.apache.sis.util.iso;
 
 import java.util.Set;
 import java.util.Map;
-import java.util.Collections;
 import java.util.LinkedHashMap;
+import java.util.Arrays;
 import java.io.Serializable;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.InvalidObjectException;
 import javax.xml.bind.annotation.XmlType;
 import org.opengis.util.Type;
 import org.opengis.util.TypeName;
+import org.opengis.util.LocalName;
 import org.opengis.util.MemberName;
+import org.opengis.util.GenericName;
+import org.opengis.util.NameSpace;
+import org.opengis.util.NameFactory;
 import org.opengis.util.Record;
 import org.opengis.util.RecordType;
 import org.opengis.util.RecordSchema;
-import org.apache.sis.util.Debug;
 import org.apache.sis.util.ArgumentChecks;
 import org.apache.sis.util.resources.Errors;
-import org.apache.sis.internal.util.CollectionsExt;
+import org.apache.sis.util.collection.Containers;
+import org.apache.sis.util.ObjectConverters;
+import org.apache.sis.internal.converter.SurjectiveConverter;
 
 // Branch-dependent imports
 import org.apache.sis.internal.jdk7.Objects;
@@ -43,23 +52,52 @@ import org.apache.sis.internal.jdk7.Obje
  * arbitrary amount of {@linkplain #getMembers() members} as (<var>name</var>, <var>type</var>) pairs.
  * A {@code RecordType} may therefore contain another {@code RecordType} as a member.
  *
- * {@section Comparison with Java reflection}
+ * <div class="note"><b>Comparison with Java reflection:</b>
  * {@code RecordType} instances can be though as equivalent to instances of the Java {@link Class} class.
  * The set of members in a {@code RecordType} can be though as equivalent to the set of fields in a class.
+ * </div>
+ *
+ * {@section Instantiation}
+ * The easiest way to create {@code DefaultRecordType} instances is to use the
+ * {@link DefaultRecordSchema#createRecordType(CharSequence, Map)} method.
+ * Example:
+ *
+ * <div class="note">
+ * {@preformat java
+ *     DefaultRecordSchema schema = new DefaultRecordSchema(null, null, "MySchema");
+ *     // The same instance can be reused for all records to create in that schema.
+ *
+ *     Map<CharSequence,Class<?>> members = new LinkedHashMap<>();
+ *     members.put("city",        String .class);
+ *     members.put("latitude",    Double .class);
+ *     members.put("longitude",   Double .class);
+ *     members.put("population",  Integer.class);
+ *     RecordType record = schema.createRecordType("MyRecordType", members);
+ * }
+ * </div>
  *
  * {@section Immutability and thread safety}
- * This class is immutable and thus inherently thread-safe if the {@link TypeName} and {@link RecordSchema} arguments,
- * as well as all ({@link MemberName}, {@link Type}) entries in the map given to the constructor, are also immutable.
+ * This class is immutable and thus inherently thread-safe if the {@link TypeName}, the {@link RecordSchema}
+ * and all ({@link MemberName}, {@link Type}) entries in the map given to the constructor are also immutable.
  * Subclasses shall make sure that any overridden methods remain safe to call from multiple threads and do not change
  * any public {@code RecordType} state.
  *
+ * {@section Serialization}
+ * This class is serializable if all elements given to the constructor are also serializable.
+ * Note in particular that {@link DefaultRecordSchema} is currently <strong>not</strong> serializable,
+ * so users wanting serialization may need to provide their own schema.
+ *
  * @author  Martin Desruisseaux (IRD, Geomatys)
  * @since   0.3
- * @version 0.3
+ * @version 0.5
  * @module
+ *
+ * @see DefaultRecord
+ * @see DefaultRecordSchema
+ * @see DefaultMemberName
  */
 @XmlType(name = "RecordType")
-public class DefaultRecordType implements RecordType, Serializable {
+public class DefaultRecordType extends RecordDefinition implements RecordType, Serializable {
     /**
      * For cross-version compatibility.
      */
@@ -80,20 +118,18 @@ public class DefaultRecordType implement
     private final RecordSchema container;
 
     /**
-     * The dictionary of (<var>name</var>, <var>type</var>) pairs.
+     * The type of each members.
      *
-     * @see #getMembers()
      * @see #getMemberTypes()
      */
-    private final Map<MemberName,Type> memberTypes;
+    private transient Type[] memberTypes;
 
     /**
      * Empty constructor only used by JAXB.
      */
     private DefaultRecordType() {
-        typeName    = null;
-        container   = null;
-        memberTypes = Collections.emptyMap();
+        typeName  = null;
+        container = null;
     }
 
     /**
@@ -104,32 +140,116 @@ public class DefaultRecordType implement
     public DefaultRecordType(final RecordType other) {
         typeName    = other.getTypeName();
         container   = other.getContainer();
-        memberTypes = other.getMemberTypes();
+        memberTypes = computeTransientFields(other.getMemberTypes());
+    }
+
+    /**
+     * Creates a new record in the given schema.
+     * It is caller responsibility to add the new {@code RecordType} in the container
+     * {@linkplain RecordSchema#getDescription() description} map, if desired.
+     *
+     * <p>This constructor is provided mostly for developers who want to create {@code DefaultRecordType}
+     * instances in their own {@code RecordSchema} implementation. Otherwise if the default record schema
+     * implementation is sufficient, the {@link DefaultRecordSchema#createRecordType(CharSequence, Map)}
+     * method provides an easier alternative.</p>
+     *
+     * @param typeName  The name that identifies this record type.
+     * @param container The schema that contains this record type.
+     * @param members   The name and type of the members to be included in this record type.
+     *
+     * @see DefaultRecordSchema#createRecordType(CharSequence, Map)
+     */
+    public DefaultRecordType(final TypeName typeName, final RecordSchema container,
+            final Map<? extends MemberName, ? extends Type> members)
+    {
+        ArgumentChecks.ensureNonNull("typeName",  typeName);
+        ArgumentChecks.ensureNonNull("container", container);
+        ArgumentChecks.ensureNonNull("members",   members);
+        this.typeName    = typeName;
+        this.container   = container;
+        this.memberTypes = computeTransientFields(members);
+        /*
+         * Ensure that the record namespace is equals to the schema name. For example if the schema
+         * name is "MyNameSpace", then the record type name can be "MyNameSpace:MyRecordType".
+         */
+        final LocalName   schemaName   = container.getSchemaName();
+        final GenericName fullTypeName = typeName.toFullyQualifiedName();
+        if (schemaName.compareTo(typeName.scope().name().tip()) != 0) {
+            throw new IllegalArgumentException(Errors.format(Errors.Keys.InconsistentNamespace_2, schemaName, fullTypeName));
+        }
+        final int size = size();
+        for (int i=0; i<size; i++) {
+            final MemberName name = getName(i);
+            final Type type = this.memberTypes[i];
+            if (type == null || name.getAttributeType().compareTo(type.getTypeName()) != 0) {
+                throw new IllegalArgumentException(Errors.format(Errors.Keys.IllegalMemberType_2, name, type));
+            }
+            if (fullTypeName.compareTo(name.scope().name()) != 0) {
+                throw new IllegalArgumentException(Errors.format(Errors.Keys.InconsistentNamespace_2,
+                        fullTypeName, name.toFullyQualifiedName()));
+            }
+        }
     }
 
     /**
-     * Creates a new record.
+     * Creates a new record from member names specified as character sequence.
+     * This constructor builds the {@link MemberName} instance itself.
      *
      * @param typeName    The name that identifies this record type.
      * @param container   The schema that contains this record type.
-     * @param memberTypes The name of the members to be included in this record type.
+     * @param members     The name of the members to be included in this record type.
+     * @param nameFactory The factory to use for instantiating {@link MemberName}.
      */
-    public DefaultRecordType(final TypeName typeName, final RecordSchema container, Map<MemberName,Type> memberTypes) {
-        ArgumentChecks.ensureNonNull("typeName",    typeName);
-        ArgumentChecks.ensureNonNull("container",   container);
-        ArgumentChecks.ensureNonNull("memberTypes", memberTypes);
-        memberTypes = new LinkedHashMap<MemberName,Type>(memberTypes);
-        memberTypes.remove(null);
-        for (final Map.Entry<MemberName,Type> entry : memberTypes.entrySet()) {
-            final MemberName name = entry.getKey();
-            final Type type = entry.getValue();
-            if (type == null || !name.getAttributeType().equals(type.getTypeName())) {
-                throw new IllegalArgumentException(Errors.format(Errors.Keys.IllegalMemberType_2, name, type));
+    DefaultRecordType(final TypeName typeName, final RecordSchema container,
+            final Map<? extends CharSequence, ? extends Type> members, final NameFactory nameFactory)
+    {
+        this.typeName  = typeName;
+        this.container = container;
+        final NameSpace namespace = nameFactory.createNameSpace(typeName, null);
+        final Map<MemberName,Type> memberTypes = new LinkedHashMap<MemberName,Type>(Containers.hashMapCapacity(members.size()));
+        for (final Map.Entry<? extends CharSequence, ? extends Type> entry : members.entrySet()) {
+            final Type         type   = entry.getValue();
+            final CharSequence name   = entry.getKey();
+            final MemberName   member = nameFactory.createMemberName(namespace, name, type.getTypeName());
+            if (memberTypes.put(member, type) != null) {
+                throw new IllegalArgumentException(Errors.format(Errors.Keys.DuplicatedElement_1, member));
             }
         }
-        this.typeName    = typeName;
-        this.container   = container;
-        this.memberTypes = CollectionsExt.unmodifiableOrCopy(memberTypes);
+        this.memberTypes = computeTransientFields(memberTypes);
+    }
+
+    /**
+     * Invoked on deserialization for restoring the transient fields.
+     * See {@link #writeObject(ObjectOutputStream)} for the stream data description.
+     */
+    private void readObject(final ObjectInputStream in) throws IOException, ClassNotFoundException {
+        in.defaultReadObject();
+        final int size = in.readInt();
+        final Map<MemberName,Type> members = new LinkedHashMap<MemberName,Type>(Containers.hashMapCapacity(size));
+        for (int i=0; i<size; i++) {
+            final MemberName member = (MemberName) in.readObject();
+            final Type type = (Type) in.readObject();
+            if (members.put(member, type) != null) {
+                throw new InvalidObjectException(Errors.format(Errors.Keys.DuplicatedElement_1, member));
+            }
+        }
+        memberTypes = computeTransientFields(members);
+    }
+
+    /**
+     * Invoked on serialization for writing the member names and their type.
+     *
+     * @serialData The number of members as an {@code int}, followed by a
+     *             ({@code MemberName}, {@code Type}) pair for each member.
+     */
+    private void writeObject(final ObjectOutputStream out) throws IOException {
+        final int size = size();
+        out.defaultWriteObject();
+        out.writeInt(size);
+        for (int i=0; i<size; i++) {
+            out.writeObject(getName(i));
+            out.writeObject(memberTypes[i]);
+        }
     }
 
     /**
@@ -159,6 +279,14 @@ public class DefaultRecordType implement
     }
 
     /**
+     * Returns {@code this} since {@link RecordDefinition} is the definition of this record type.
+     */
+    @Override
+    final RecordType getRecordType() {
+        return this;
+    }
+
+    /**
      * Returns the name that identifies this record type. If this {@code RecordType} is contained in a
      * {@linkplain DefaultRecordSchema record schema}, then the record type name shall be valid in the
      * {@linkplain DefaultNameSpace name space} of the record schema:
@@ -167,9 +295,10 @@ public class DefaultRecordType implement
      *     NameSpace namespace = getContainer().getSchemaName().scope()
      * }
      *
-     * {@section Comparison with Java reflection}
+     * <div class="note"><b>Comparison with Java reflection:</b>
      * If we think about this {@code RecordType} as equivalent to a {@code Class} instance,
      * then this method can be think as the equivalent of the Java {@link Class#getName()} method.
+     * </div>
      *
      * @return The name that identifies this record type.
      */
@@ -192,15 +321,20 @@ public class DefaultRecordType implement
      * Returns the dictionary of all (<var>name</var>, <var>type</var>) pairs in this record type.
      * The returned map is unmodifiable.
      *
-     * {@section Comparison with Java reflection}
+     * <div class="note"><b>Comparison with Java reflection:</b>
      * If we think about this {@code RecordType} as equivalent to a {@code Class} instance, then
      * this method can be though as the related to the Java {@link Class#getFields()} method.
+     * </div>
      *
      * @return The dictionary of (<var>name</var>, <var>type</var>) pairs, or an empty map if none.
      */
     @Override
-    public Map<MemberName, Type> getMemberTypes() {
-        return memberTypes;
+    public Map<MemberName,Type> getMemberTypes() {
+        return ObjectConverters.derivedValues(memberIndices(), MemberName.class, new SurjectiveConverter<Integer,Type>() {
+            @Override public Class<Integer> getSourceClass() {return Integer.class;}
+            @Override public Class<Type>    getTargetClass() {return Type.class;}
+            @Override public Type apply(final Integer index) {return getType(index);}
+        });
     }
 
     /**
@@ -215,7 +349,14 @@ public class DefaultRecordType implement
      */
     @Override
     public Set<MemberName> getMembers() {
-        return memberTypes.keySet();
+        return memberIndices().keySet();
+    }
+
+    /**
+     * Returns the type at the given index.
+     */
+    final Type getType(final int index) {
+        return memberTypes[index];
     }
 
     /**
@@ -226,17 +367,18 @@ public class DefaultRecordType implement
      *     getMemberTypes().get(memberName).getTypeName();
      * }
      *
-     * {@section Comparison with Java reflection}
+     * <div class="note"><b>Comparison with Java reflection:</b>
      * If we think about this {@code RecordType} as equivalent to a {@code Class} instance, then
      * this method can be though as related to the Java {@link Class#getField(String)} method.
+     * </div>
      *
      * @param  memberName The attribute name for which to get the associated type name.
      * @return The associated type name, or {@code null} if none.
      */
     @Override
     public TypeName locate(final MemberName memberName) {
-        final Type type = memberTypes.get(memberName);
-        return (type != null) ? type.getTypeName() : null;
+        final Integer index = indexOf(memberName);
+        return (index != null) ? getType(index).getTypeName() : null;
     }
 
     /**
@@ -273,9 +415,10 @@ public class DefaultRecordType implement
         }
         if (other != null && other.getClass() == getClass()) {
             final DefaultRecordType that = (DefaultRecordType) other;
-            return Objects.equals(typeName,    that.typeName)  &&
-                   Objects.equals(container,   that.container) &&
-                   Objects.equals(memberTypes, that.memberTypes);
+            return Objects.equals(typeName,    that.typeName)    &&
+                   Objects.equals(container,   that.container)   &&
+                   Arrays .equals(memberTypes, that.memberTypes) &&
+                   memberIndices().equals(that.memberIndices());
         }
         return false;
     }
@@ -285,19 +428,6 @@ public class DefaultRecordType implement
      */
     @Override
     public int hashCode() {
-        int code = memberTypes.hashCode();
-        if (typeName  != null) code = 31*code + typeName .hashCode();
-        if (container != null) code = 31*code + container.hashCode();
-        return code;
-    }
-
-    /**
-     * Returns a string representation of this {@code RecordType}.
-     * The string representation is for debugging purpose and may change in any future SIS version.
-     */
-    @Debug
-    @Override
-    public String toString() {
-        return "RecordType[\"" + typeName + "\"]";
+        return Objects.hashCode(typeName) + 31*(memberIndices().hashCode() + 31*Arrays.hashCode(memberTypes));
     }
 }

Modified: sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultScopedName.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultScopedName.java?rev=1609865&r1=1609864&r2=1609865&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultScopedName.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultScopedName.java [UTF-8] Fri Jul 11 23:13:07 2014
@@ -52,6 +52,9 @@ import org.apache.sis.internal.util.Unmo
  * @since   0.3 (derived from geotk-2.1)
  * @version 0.3
  * @module
+ *
+ * @see DefaultNameSpace
+ * @see DefaultLocalName
  */
 @XmlType(name = "ScopedName") // Actually 'gml:CodeType', but the later is used elsewhere.
 @XmlRootElement(name = "ScopedName")
@@ -183,7 +186,7 @@ public class DefaultScopedName extends A
         final LocalName lastName  = locals[index-1];
         final NameSpace lastScope = lastName.scope();
         final NameSpace tailScope = name.scope();
-        if (tailScope instanceof DefaultNameSpace && ((DefaultNameSpace) tailScope).parent == lastScope) {
+        if (tailScope instanceof DefaultNameSpace && ((DefaultNameSpace) tailScope).parent() == lastScope) {
             /*
              * If the tail is actually the tip (a LocalName), remember the tail so we
              * don't need to create it again later. Then copy the tail after the path.

Modified: sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultTypeName.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultTypeName.java?rev=1609865&r1=1609864&r2=1609865&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultTypeName.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultTypeName.java [UTF-8] Fri Jul 11 23:13:07 2014
@@ -39,6 +39,9 @@ import org.opengis.util.NameSpace;
  * @since   0.3 (derived from geotk-3.00)
  * @version 0.3
  * @module
+ *
+ * @see DefaultMemberName
+ * @see DefaultNameFactory
  */
 @XmlRootElement(name = "TypeName")
 public class DefaultTypeName extends DefaultLocalName implements TypeName {

Modified: sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/iso/Names.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/iso/Names.java?rev=1609865&r1=1609864&r2=1609865&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/iso/Names.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/iso/Names.java [UTF-8] Fri Jul 11 23:13:07 2014
@@ -17,6 +17,7 @@
 package org.apache.sis.util.iso;
 
 import java.util.Collections;
+import org.opengis.util.TypeName;
 import org.opengis.util.LocalName;
 import org.opengis.util.GenericName;
 import org.opengis.util.NameSpace;
@@ -70,6 +71,13 @@ import static org.apache.sis.util.Argume
  * @since   0.5
  * @version 0.5
  * @module
+ *
+ * @see DefaultNameFactory
+ * @see DefaultNameSpace
+ * @see DefaultScopedName
+ * @see DefaultLocalName
+ * @see DefaultTypeName
+ * @see DefaultMemberName
  */
 public final class Names extends Static {
     /**
@@ -100,12 +108,8 @@ public final class Names extends Static 
      * Those character sequences are taken verbatim; they are <em>not</em> parsed into their components.
      *
      * <div class="note"><b>Note:</b> it is possible to split the {@code namespace} and {@code localPart}
-     * strings into smaller name components. If such finer grain control is desired, one can use
-     * {@link DefaultNameFactory} instead of this {@code Names} class.</div>
-     *
-     * <div class="note"><b>Performance note:</b> this method is okay for <em>casual</em> use. If many names need
-     * to be created in the same namespace, then {@link DefaultNameFactory#createLocalName(NameSpace, CharSequence)}
-     * is more efficient since it allows to create the {@code NameSpace} object only once.</div>
+     * strings into smaller name components (e.g. namespaces contained in other namespaces). If such finer
+     * grain control is desired, one can use {@link DefaultNameFactory} instead of this {@code Names} class.</div>
      *
      * The following table shows where the strings given in argument will go:
      *
@@ -117,7 +121,7 @@ public final class Names extends Static 
      * </table></blockquote>
      *
      * <div class="note"><b>Example:</b>
-     * for a name created by {@code create("http://www.opengis.net/gml/srs/epsg.xml", "#", "4326")}:
+     * for a name created by {@code createLocalName("http://www.opengis.net/gml/srs/epsg.xml", "#", "4326")}:
      * <blockquote><table class="compact" summary="Examples of return values for a name built by this method.">
      *   <tr><td>• <code>name.{@linkplain DefaultLocalName#toString() toString()}</code></td>
      *       <td>returns the {@code "4326"} string.</td></tr>
@@ -129,6 +133,10 @@ public final class Names extends Static 
      *       <td>returns the {@code "{http://www.opengis.net/gml/srs/epsg.xml}4326"} string.</td></tr>
      * </table></blockquote></div>
      *
+     * <div class="note"><b>Performance note:</b> this method is okay for <em>casual</em> use. If many names need
+     * to be created in the same namespace, then {@link DefaultNameFactory#createLocalName(NameSpace, CharSequence)}
+     * is more efficient since it allows to create the {@code NameSpace} object only once.</div>
+     *
      * @param  namespace The namespace, or {@code null} for the global namespace.
      * @param  separator The separator between the namespace and the local part.
      * @param  localPart The name which is locale in the given namespace.
@@ -141,6 +149,29 @@ public final class Names extends Static 
     }
 
     /**
+     * Creates a type name which is local in the given namespace.
+     * The character sequences can be either {@link String} or {@link InternationalString} instances.
+     * Those character sequences are taken verbatim; they are <em>not</em> parsed into their components.
+     *
+     * <div class="note"><b>Example:</b> {@code createTypeName("gco", ":", "Integer")} returns a name
+     * which can be used for representing the type of {@code <gco:Integer>} elements in XML files.</div>
+     *
+     * <div class="note"><b>Performance note:</b> this method is okay for <em>casual</em> use. If many names need
+     * to be created in the same namespace, then {@link DefaultNameFactory#createTypeName(NameSpace, CharSequence)}
+     * is more efficient since it allows to create the {@code NameSpace} object only once.</div>
+     *
+     * @param  namespace The namespace, or {@code null} for the global namespace.
+     * @param  separator The separator between the namespace and the local part.
+     * @param  localPart The name which is locale in the given namespace.
+     * @return A local name in the given namespace.
+     */
+    public static TypeName createTypeName(final CharSequence namespace, final String separator, final CharSequence localPart) {
+        ensureNonNull("localPart", localPart);
+        ensureNonNull("separator", separator);
+        return DefaultFactories.NAMES.createTypeName(createNameSpace(namespace, separator), localPart);
+    }
+
+    /**
      * Formats the given name in <cite>expanded form</cite> close to the Java Content Repository (JCR) definition.
      * The expanded form is defined as below:
      *

Copied: sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/iso/RecordDefinition.java (from r1609863, sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/iso/RecordDefinition.java)
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/iso/RecordDefinition.java?p2=sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/iso/RecordDefinition.java&p1=sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/iso/RecordDefinition.java&r1=1609863&r2=1609865&rev=1609865&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/iso/RecordDefinition.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/iso/RecordDefinition.java [UTF-8] Fri Jul 11 23:13:07 2014
@@ -34,6 +34,9 @@ import org.apache.sis.util.CharSequences
 import org.apache.sis.util.collection.Containers;
 import org.apache.sis.internal.util.CollectionsExt;
 
+// Branch-dependent imports
+import org.apache.sis.internal.jdk7.JDK7;
+
 
 /**
  * Holds a {@code Record} definition in a way more convenient for Apache SIS than
@@ -144,7 +147,7 @@ abstract class RecordDefinition { // Int
     final Type[] computeTransientFields(final Map<? extends MemberName, ? extends Type> memberTypes) {
         final int size = memberTypes.size();
         members       = new MemberName[size];
-        memberIndices = new LinkedHashMap<>(Containers.hashMapCapacity(size));
+        memberIndices = new LinkedHashMap<MemberName,Integer>(Containers.hashMapCapacity(size));
         final Type[] types = new Type[size];
         int i = 0;
         for (final Map.Entry<? extends MemberName, ? extends Type> entry : memberTypes.entrySet()) {
@@ -233,7 +236,7 @@ abstract class RecordDefinition { // Int
      */
     final String toString(final String head, final Object values) {
         final StringBuilder buffer = new StringBuilder(250);
-        final String lineSeparator = System.lineSeparator();
+        final String lineSeparator = JDK7.lineSeparator();
         final String[] names = new String[members.length];
         int width = 0;
         buffer.append(head).append("[“").append(getRecordType().getTypeName()).append("”] {").append(lineSeparator);

Modified: sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/iso/package-info.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/iso/package-info.java?rev=1609865&r1=1609864&r2=1609865&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/iso/package-info.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/iso/package-info.java [UTF-8] Fri Jul 11 23:13:07 2014
@@ -38,6 +38,13 @@
  *       <li>{@link org.apache.sis.util.iso.DefaultScopedName} for a composite of a <cite>head</cite> name and a <cite>tail</cite> name.</li>
  *     </ul>
  *   </li>
+ *   <li>Implementations of {@link org.opengis.util.Record} and related classes:
+ *     <ul>
+ *       <li>{@link org.apache.sis.util.iso.DefaultRecord}       for a list of logically related elements as (<var>name</var>, <var>value</var>) pairs.</li>
+ *       <li>{@link org.apache.sis.util.iso.DefaultRecordType}   for definition of the type of a {@code Record}.</li>
+ *       <li>{@link org.apache.sis.util.iso.DefaultRecordSchema} for a collection of {@code RecordType}s in a given namespace.</li>
+ *     </ul>
+ *   </li>
  *   <li>Static utility methods:
  *     <ul>
  *       <li>{@link org.apache.sis.util.iso.Types} for working with UML identifiers and description of GeoAPI types.</li>

Modified: sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java?rev=1609865&r1=1609864&r2=1609865&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java [UTF-8] Fri Jul 11 23:13:07 2014
@@ -373,6 +373,11 @@ public final class Errors extends Indexe
         public static final short InconsistentAttribute_2 = 47;
 
         /**
+         * Expected “{0}” namespace for “{1}”.
+         */
+        public static final short InconsistentNamespace_2 = 162;
+
+        /**
          * Inconsistent table columns.
          */
         public static final short InconsistentTableColumns = 48;
@@ -453,6 +458,11 @@ public final class Errors extends Indexe
         public static final short MissingAuthority_1 = 135;
 
         /**
+         * “{0}” has no namespace.
+         */
+        public static final short MissingNamespace_1 = 163;
+
+        /**
          * This operation requires the “{0}” module.
          */
         public static final short MissingRequiredModule_1 = 61;
@@ -668,6 +678,11 @@ public final class Errors extends Indexe
         public static final short PropertyNotFound_2 = 71;
 
         /**
+         * Record “{1}” is already defined in schema “{0}”.
+         */
+        public static final short RecordAlreadyDefined_2 = 161;
+
+        /**
          * Recursive call while creating an object for the “{0}” key.
          */
         public static final short RecursiveCreateCallForKey_1 = 99;

Modified: sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties?rev=1609865&r1=1609864&r2=1609865&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties [ISO-8859-1] (original)
+++ sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties [ISO-8859-1] Fri Jul 11 23:13:07 2014
@@ -84,6 +84,7 @@ IncompatiblePropertyValue_1       = Prop
 IncompatibleUnit_1                = Unit \u201c{0}\u201d is incompatible with current value.
 IncompatibleUnits_2               = Units \u201c{0}\u201d and \u201c{1}\u201d are incompatible.
 InconsistentAttribute_2           = Value \u201c{1}\u201d of attribute \u2018{0}\u2019 is inconsistent with other attributes.
+InconsistentNamespace_2           = Expected \u201c{0}\u201d namespace for \u201c{1}\u201d.
 InconsistentTableColumns          = Inconsistent table columns.
 IdentifierAlreadyBound_1          = Identifier \u201c{0}\u201d is already associated to another object.
 IndexOutOfBounds_1                = Index {0} is out of bounds.
@@ -101,6 +102,7 @@ MismatchedParameterDescriptor_1   = Mism
 MismatchedPropertyType_1          = Mismatched type for \u201c{0}\u201d property.
 MismatchedValueClass_3            = Class of \u201c{0}\u201d values is \u2018{2}\u2019, but the requested type is \u2018{1}\u2019.
 MissingAuthority_1                = No authority was specified for code \u201c{0}\u201d. The expected syntax is \u201cAUTHORITY:CODE\u201d.
+MissingNamespace_1                = \u201c{0}\u201d has no namespace.
 MissingRequiredModule_1           = This operation requires the \u201c{0}\u201d module.
 MissingSchemeInURI                = Missing scheme in URI.
 MissingValueForOption_1           = Missing value for \u201c{0}\u201d option.
@@ -145,9 +147,10 @@ OddArrayLength_1                  = Arra
 PropertyAlreadyExists_2           = Property \u201c{1}\u201d is already exists in \u201c{0}\u201d.
 ParameterNotFound_2               = No parameter named \u201c{1}\u201d has been found in \u201c{0}\u201d.
 PropertyNotFound_2                = No property named \u201c{1}\u201d has been found in \u201c{0}\u201d.
-SingularMatrix                    = Matrix is singular.
+RecordAlreadyDefined_2            = Record \u201c{1}\u201d is already defined in schema \u201c{0}\u201d.
 RecursiveCreateCallForKey_1       = Recursive call while creating an object for the \u201c{0}\u201d key.
 RequireDecimalSeparator           = A decimal separator is required.
+SingularMatrix                    = Matrix is singular.
 StalledThread_1                   = Thread \u201c{0}\u201d seems stalled.
 StreamIsForwardOnly_1             = Can not move backward in the \u201c{0}\u201d stream.
 TooFewArguments_2                 = Expected at least {0} argument{0,choice,1#|2#s}, but got {1}.

Modified: sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties?rev=1609865&r1=1609864&r2=1609865&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties [ISO-8859-1] (original)
+++ sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties [ISO-8859-1] Fri Jul 11 23:13:07 2014
@@ -74,6 +74,7 @@ IncompatiblePropertyValue_1       = La v
 IncompatibleUnit_1                = L\u2019unit\u00e9 \u00ab\u202f{0}\u202f\u00bb n\u2019est pas compatible avec la valeur actuelle.
 IncompatibleUnits_2               = Les unit\u00e9s \u00ab\u202f{0}\u202f\u00bb et \u00ab\u202f{1}\u202f\u00bb ne sont pas compatibles.
 InconsistentAttribute_2           = La valeur \u00ab\u202f{1}\u202f\u00bb de l\u2019attribut \u2018{0}\u2019 n\u2019est pas coh\u00e9rente avec celles des autres attributs.
+InconsistentNamespace_2           = L\u2019espace de nom \u201c{0}\u201d \u00e9tait attendu pour \u201c{1}\u201d.
 InconsistentTableColumns          = Les colonnes des tables ne sont pas coh\u00e9rentes.
 IdentifierAlreadyBound_1          = L\u2019identifiant \u00ab\u202f{0}\u202f\u00bb est d\u00e9j\u00e0 associ\u00e9 \u00e0 un autre objet.
 IndexOutOfBounds_1                = L\u2019index {0} est en dehors des limites permises.
@@ -91,6 +92,7 @@ MismatchedParameterDescriptor_1   = Le d
 MismatchedPropertyType_1          = Le type de la propri\u00e9t\u00e9 \u00ab\u202f{0}\u202f\u00bb ne correspond pas.
 MismatchedValueClass_3            = Les valeurs de \u00ab\u202f{0}\u202f\u00bb sont de la classe \u2018{2}\u2019, alors que le type demand\u00e9 \u00e9tait \u2018{1}\u2019.
 MissingAuthority_1                = Aucune autorit\u00e9 n\u2019a \u00e9t\u00e9 sp\u00e9cifi\u00e9e pour le code \u00ab\u202f{0}\u202f\u00bb. Le format attendu est \u00ab\u202fAUTORIT\u00c9:CODE\u202f\u00bb.
+MissingNamespace_1                = \u201c{0}\u201d est d\u00e9fini sans espace de noms.
 MissingRequiredModule_1           = Cette op\u00e9ration requiert le module \u00ab\u202f{0}\u202f\u00bb.
 MissingSchemeInURI                = Il manque le sch\u00e9ma d\u2019URI.
 MissingValueForOption_1           = Aucune valeur n\u2019a \u00e9t\u00e9 d\u00e9finie pour l\u2019option \u00ab\u202f{0}\u202f\u00bb.
@@ -134,6 +136,7 @@ OddArrayLength_1                  = La l
 PropertyAlreadyExists_2           = La propri\u00e9t\u00e9 \u00ab\u202f{1}\u202f\u00bb existe d\u00e9j\u00e0 dans \u00ab\u202f{0}\u202f\u00bb.
 ParameterNotFound_2               = Aucun param\u00e8tre nomm\u00e9 \u00ab\u202f{1}\u202f\u00bb n\u2019a \u00e9t\u00e9 trouv\u00e9 dans \u00ab\u202f{0}\u202f\u00bb.
 PropertyNotFound_2                = Aucune propri\u00e9t\u00e9 nomm\u00e9e \u00ab\u202f{1}\u202f\u00bb n\u2019a \u00e9t\u00e9 trouv\u00e9e dans \u00ab\u202f{0}\u202f\u00bb.
+RecordAlreadyDefined_2            = L\u2019enregistrement \u00ab\u202f{1}\u202f\u00bb est d\u00e9j\u00e0 d\u00e9finit dans le sch\u00e9ma \u00ab\u202f{0}\u202f\u00bb.
 RecursiveCreateCallForKey_1       = Appel r\u00e9cursif lors de la cr\u00e9ation d\u2019un objet pour la cl\u00e9 \u00ab\u202f{0}\u202f\u00bb.
 RequireDecimalSeparator           = Un s\u00e9parateur d\u00e9cimal est requis.
 SingularMatrix                    = La matrice est singuli\u00e8re.

Modified: sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/resources/Messages.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/resources/Messages.java?rev=1609865&r1=1609864&r2=1609865&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/resources/Messages.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/resources/Messages.java [UTF-8] Fri Jul 11 23:13:07 2014
@@ -76,6 +76,11 @@ public final class Messages extends Inde
         public static final short IgnoredPropertiesAfterFirst_1 = 6;
 
         /**
+         * Ignored property associated to ‘{0}’.
+         */
+        public static final short IgnoredPropertyAssociatedTo_1 = 7;
+
+        /**
          * Text were discarded for some locales.
          */
         public static final short LocalesDiscarded = 3;

Modified: sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/resources/Messages.properties
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/resources/Messages.properties?rev=1609865&r1=1609864&r2=1609865&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/resources/Messages.properties [ISO-8859-1] (original)
+++ sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/resources/Messages.properties [ISO-8859-1] Fri Jul 11 23:13:07 2014
@@ -18,6 +18,7 @@ AlreadyRegistered_2             = {0} \u
 ChangedContainerCapacity_2      = Changed the container capacity from {0} to {1} elements.
 DiscardedExclusiveProperty_2    = Property \u201c{0}\u201d has been discarded in favor of \u201c{1}\u201d, because those two properties are mutually exclusive.
 IgnoredPropertiesAfterFirst_1   = Ignored properties after the first occurrence of \u2018{0}\u2019.
+IgnoredPropertyAssociatedTo_1   = Ignored property associated to \u2018{0}\u2019.
 PropertyHiddenBy_2              = Property \u201c{0}\u201d is hidden by \u201c{1}\u201d.
 LocalesDiscarded                = Text were discarded for some locales.
 UnparsableValueStoredAsText_2   = Can not parse \u201c{1}\u201d as an instance of \u2018{0}\u2019. The value is stored as plain text instead, but will be ignored by some processing.

Modified: sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/resources/Messages_fr.properties
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/resources/Messages_fr.properties?rev=1609865&r1=1609864&r2=1609865&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/resources/Messages_fr.properties [ISO-8859-1] (original)
+++ sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/resources/Messages_fr.properties [ISO-8859-1] Fri Jul 11 23:13:07 2014
@@ -18,6 +18,7 @@ AlreadyRegistered_2             = Le {0}
 ChangedContainerCapacity_2      = Changement de la capacit\u00e9 du conteneur de {0} vers {1} \u00e9l\u00e9ments.
 DiscardedExclusiveProperty_2    = La propri\u00e9t\u00e9 \u00ab\u202f{0}\u202f\u00bb a \u00e9t\u00e9 \u00e9cart\u00e9e en faveur de \u00ab\u202f{1}\u202f\u00bb, parce que ces deux propri\u00e9t\u00e9s sont mutuellement exclusives.
 IgnoredPropertiesAfterFirst_1   = Des propri\u00e9t\u00e9s ont \u00e9t\u00e9 ignor\u00e9es apr\u00e8s la premi\u00e8re occurrence de \u2018{0}\u2019.
+IgnoredPropertyAssociatedTo_1   = Une propri\u00e9t\u00e9 associ\u00e9e \u00e0 \u2018{0}\u2019 a \u00e9t\u00e9 ignor\u00e9e.
 PropertyHiddenBy_2              = La propri\u00e9t\u00e9 \u00ab\u202f{0}\u202f\u00bb est masqu\u00e9e par \u00ab\u202f{1}\u202f\u00bb.
 LocalesDiscarded                = Des textes ont \u00e9t\u00e9 ignor\u00e9s pour certaines langues.
 UnparsableValueStoredAsText_2   = La valeur \u00ab\u202f{1}\u202f\u00bb ne peut pas \u00eatre interpr\u00e9t\u00e9e comme une instance de \u2018{0}\u2019. Elle est donc m\u00e9moris\u00e9e sous sa forme textuelle, mais sera ignor\u00e9e par certains traitements.

Modified: sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/internal/util/CollectionsExtTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/internal/util/CollectionsExtTest.java?rev=1609865&r1=1609864&r2=1609865&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/internal/util/CollectionsExtTest.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/internal/util/CollectionsExtTest.java [UTF-8] Fri Jul 11 23:13:07 2014
@@ -26,6 +26,7 @@ import java.util.EnumSet;
 import java.util.HashSet;
 import java.util.Collection;
 import java.util.Collections;
+import java.util.Iterator;
 import java.util.Locale;
 import org.apache.sis.util.collection.CodeListSet;
 import org.apache.sis.util.ObjectConverters;
@@ -43,7 +44,7 @@ import org.apache.sis.internal.jdk8.Func
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.3
- * @version 0.4
+ * @version 0.5
  * @module
  */
 public final strictfp class CollectionsExtTest extends TestCase {
@@ -140,4 +141,16 @@ public final strictfp class CollectionsE
             assertMapEquals(expected, CollectionsExt.toCaseInsensitiveNameMap(elements, nameFunction, Locale.ROOT));
         }
     }
+
+    /**
+     * Tests {@link CollectionsExt#identityEquals(Iterator, Iterator)}.
+     */
+    @Test
+    public void testIdentityEquals() {
+        final List<String> c1 = Arrays.asList("A", "B", "C");
+        final List<String> c2 = Arrays.asList("A", "B");
+        assertFalse(CollectionsExt.identityEquals(c1.iterator(), c2.iterator()));
+        assertFalse(CollectionsExt.identityEquals(c2.iterator(), c1.iterator()));
+        assertTrue(CollectionsExt.identityEquals(c1.iterator(), Arrays.asList("A", "B", "C").iterator()));
+    }
 }

Modified: sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/test/AnnotationsTestCase.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/test/AnnotationsTestCase.java?rev=1609865&r1=1609864&r2=1609865&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/test/AnnotationsTestCase.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/test/AnnotationsTestCase.java [UTF-8] Fri Jul 11 23:13:07 2014
@@ -276,8 +276,10 @@ public abstract strictfp class Annotatio
         } else {
             namespace = schemaNamespace;
         }
-        assertEquals("Wrong namespace for the ISO specification.",
-                getExpectedNamespace(impl, (uml != null) ? uml.specification() : null), namespace);
+        if (uml != null) {
+            assertEquals("Wrong namespace for the ISO specification.",
+                    getExpectedNamespace(impl, uml.specification()), namespace);
+        }
         return namespace;
     }
 
@@ -350,18 +352,11 @@ public abstract strictfp class Annotatio
 
     /**
      * Returns {@code true} if the given method should be ignored.
-     * This method returns {@code true} of deprecated methods and
-     * some standard methods from the JDK.
+     * This method returns {@code true} for some standard methods from the JDK.
      */
     private static boolean isIgnored(final Method method) {
-        if (method.isAnnotationPresent(Deprecated.class)) {
-            return true;
-        }
         final String name = method.getName();
-        if (name.equals("equals") || name.equals("hashCode") || name.equals("doubleValue")) {
-            return true;
-        }
-        return false;
+        return name.equals("equals") || name.equals("hashCode") || name.equals("doubleValue");
     }
 
     /**
@@ -387,7 +382,9 @@ public abstract strictfp class Annotatio
                     testingMethod = method.getName();
                     if (!isIgnored(method)) {
                         uml = method.getAnnotation(UML.class);
-                        assertNotNull("Missing @UML annotation.", uml);
+                        if (!method.isAnnotationPresent(Deprecated.class)) {
+                            assertNotNull("Missing @UML annotation.", uml);
+                        }
                     }
                 }
             }

Modified: sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/test/suite/UtilityTestSuite.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/test/suite/UtilityTestSuite.java?rev=1609865&r1=1609864&r2=1609865&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/test/suite/UtilityTestSuite.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/test/suite/UtilityTestSuite.java [UTF-8] Fri Jul 11 23:13:07 2014
@@ -26,7 +26,7 @@ import org.junit.BeforeClass;
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.3
- * @version 0.4
+ * @version 0.5
  * @module
  */
 @Suite.SuiteClasses({
@@ -87,6 +87,9 @@ import org.junit.BeforeClass;
     org.apache.sis.util.iso.DefaultNameFactoryTest.class,
     org.apache.sis.util.iso.NamesTest.class,
     org.apache.sis.internal.simple.SimpleReferenceIdentifierTest.class,
+    org.apache.sis.util.iso.DefaultRecordTypeTest.class,
+    org.apache.sis.util.iso.DefaultRecordSchemaTest.class,
+    org.apache.sis.util.iso.DefaultRecordTest.class,
 
     // Measurements and formatting.
     org.apache.sis.measure.SexagesimalConverterTest.class,

Copied: sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/util/iso/DefaultRecordSchemaTest.java (from r1609863, sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/util/iso/DefaultRecordSchemaTest.java)
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/util/iso/DefaultRecordSchemaTest.java?p2=sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/util/iso/DefaultRecordSchemaTest.java&p1=sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/util/iso/DefaultRecordSchemaTest.java&r1=1609863&r2=1609865&rev=1609865&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/util/iso/DefaultRecordSchemaTest.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/util/iso/DefaultRecordSchemaTest.java [UTF-8] Fri Jul 11 23:13:07 2014
@@ -50,7 +50,7 @@ public final strictfp class DefaultRecor
     @Test
     public void testCreateRecordType() {
         final DefaultRecordSchema schema = new DefaultRecordSchema(null, null, "MySchema");
-        final Map<CharSequence,Class<?>> members = new LinkedHashMap<>(8);
+        final Map<CharSequence,Class<?>> members = new LinkedHashMap<CharSequence,Class<?>>(8);
         assertNull(members.put("city",       String.class));
         assertNull(members.put("latitude",   Double.class));
         assertNull(members.put("longitude",  Double.class));

Copied: sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/util/iso/DefaultRecordTest.java (from r1609863, sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/util/iso/DefaultRecordTest.java)
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/util/iso/DefaultRecordTest.java?p2=sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/util/iso/DefaultRecordTest.java&p1=sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/util/iso/DefaultRecordTest.java&r1=1609863&r2=1609865&rev=1609865&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/util/iso/DefaultRecordTest.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/util/iso/DefaultRecordTest.java [UTF-8] Fri Jul 11 23:13:07 2014
@@ -53,7 +53,7 @@ public final strictfp class DefaultRecor
     @BeforeClass
     public static void createRecordType() {
         final DefaultRecordSchema schema = new SerializableRecordSchema("MySchema");
-        final Map<CharSequence,Class<?>> members = new LinkedHashMap<>(8);
+        final Map<CharSequence,Class<?>> members = new LinkedHashMap<CharSequence,Class<?>>(8);
         assertNull(members.put("city",       String.class));
         assertNull(members.put("latitude",   Double.class));
         assertNull(members.put("longitude",  Double.class));
@@ -178,7 +178,7 @@ public final strictfp class DefaultRecor
     @Test
     @DependsOnMethod({"testSetAll", "testToString", "testSerialization"})
     public void testPrimitiveType() {
-        final Map<CharSequence,Class<?>> members = new LinkedHashMap<>(8);
+        final Map<CharSequence,Class<?>> members = new LinkedHashMap<CharSequence,Class<?>>(8);
         assertNull(members.put("latitude",  Double.class));
         assertNull(members.put("longitude", Double.class));
         final DefaultRecord record = new DefaultRecord(

Copied: sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/util/iso/DefaultRecordTypeTest.java (from r1609863, sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/util/iso/DefaultRecordTypeTest.java)
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/util/iso/DefaultRecordTypeTest.java?p2=sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/util/iso/DefaultRecordTypeTest.java&p1=sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/util/iso/DefaultRecordTypeTest.java&r1=1609863&r2=1609865&rev=1609865&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/util/iso/DefaultRecordTypeTest.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/util/iso/DefaultRecordTypeTest.java [UTF-8] Fri Jul 11 23:13:07 2014
@@ -68,7 +68,7 @@ public final strictfp class DefaultRecor
      * Creates a new record type from the current values of private fields.
      */
     private DefaultRecordType create() throws IllegalArgumentException {
-        final Type memberType = new SimpleAttributeType<>(memberTypeName, Integer.class);
+        final Type memberType = new SimpleAttributeType<Integer>(memberTypeName, Integer.class);
         return new DefaultRecordType(recordTypeName, container, Collections.singletonMap(memberName, memberType));
     }
 

Modified: sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/util/iso/TypesTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/util/iso/TypesTest.java?rev=1609865&r1=1609864&r2=1609865&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/util/iso/TypesTest.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/util/iso/TypesTest.java [UTF-8] Fri Jul 11 23:13:07 2014
@@ -16,10 +16,8 @@
  */
 package org.apache.sis.util.iso;
 
-import java.util.Set;
 import java.util.Map;
 import java.util.Arrays;
-import java.util.HashSet;
 import java.util.HashMap;
 import java.util.TreeMap;
 import java.util.Locale;
@@ -211,10 +209,9 @@ public final strictfp class TypesTest ex
      */
     @Test
     public void testGetCodeValues() {
-        final Set<OnLineFunction> expected = new HashSet<OnLineFunction>(Arrays.asList(
-                OnLineFunction.INFORMATION, OnLineFunction.SEARCH, OnLineFunction.ORDER,
-                OnLineFunction.DOWNLOAD, OnLineFunction.OFFLINE_ACCESS));
         final OnLineFunction[] actual = Types.getCodeValues(OnLineFunction.class);
-        assertTrue(expected.containsAll(Arrays.asList(actual)));
+        assertTrue(Arrays.asList(actual).containsAll(Arrays.asList(
+                OnLineFunction.INFORMATION, OnLineFunction.SEARCH, OnLineFunction.ORDER,
+                OnLineFunction.DOWNLOAD, OnLineFunction.OFFLINE_ACCESS)));
     }
 }



Mime
View raw message