You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sis.apache.org by de...@apache.org on 2015/10/23 18:04:18 UTC

svn commit: r1710256 [2/2] - in /sis/branches/JDK7: ./ core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/code/ core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/ core/sis-metadata/src/main/java/org/apache/sis/internal/met...

Modified: sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/code/MI_SequenceCode.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/code/MI_SequenceCode.java?rev=1710256&r1=1710255&r2=1710256&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/code/MI_SequenceCode.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/code/MI_SequenceCode.java [UTF-8] Fri Oct 23 16:04:17 2015
@@ -19,7 +19,7 @@ package org.apache.sis.internal.jaxb.cod
 import javax.xml.bind.annotation.XmlElement;
 import org.opengis.metadata.acquisition.Sequence;
 import org.apache.sis.internal.jaxb.gmd.CodeListAdapter;
-import org.apache.sis.internal.jaxb.gmd.CodeListProxy;
+import org.apache.sis.internal.jaxb.gmd.CodeListUID;
 import org.apache.sis.xml.Namespaces;
 
 
@@ -41,10 +41,10 @@ public final class MI_SequenceCode exten
     }
 
     /**
-     * Creates a new adapter for the given proxy.
+     * Creates a new adapter for the given value.
      */
-    private MI_SequenceCode(final CodeListProxy proxy) {
-        super(proxy);
+    private MI_SequenceCode(final CodeListUID value) {
+        super(value);
     }
 
     /**
@@ -53,8 +53,8 @@ public final class MI_SequenceCode exten
      * @return The wrapper for the code list value.
      */
     @Override
-    protected MI_SequenceCode wrap(CodeListProxy proxy) {
-        return new MI_SequenceCode(proxy);
+    protected MI_SequenceCode wrap(final CodeListUID value) {
+        return new MI_SequenceCode(value);
     }
 
     /**
@@ -74,16 +74,16 @@ public final class MI_SequenceCode exten
      */
     @Override
     @XmlElement(name = "MI_SequenceCode", namespace = Namespaces.GMI)
-    public CodeListProxy getElement() {
-        return proxy;
+    public CodeListUID getElement() {
+        return identifier;
     }
 
     /**
      * Invoked by JAXB on unmarshalling.
      *
-     * @param proxy The unmarshalled value.
+     * @param value The unmarshalled value.
      */
-    public void setElement(final CodeListProxy proxy) {
-        this.proxy = proxy;
+    public void setElement(final CodeListUID value) {
+        identifier = value;
     }
 }

Modified: sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/code/MI_TransferFunctionTypeCode.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/code/MI_TransferFunctionTypeCode.java?rev=1710256&r1=1710255&r2=1710256&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/code/MI_TransferFunctionTypeCode.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/code/MI_TransferFunctionTypeCode.java [UTF-8] Fri Oct 23 16:04:17 2015
@@ -19,7 +19,7 @@ package org.apache.sis.internal.jaxb.cod
 import javax.xml.bind.annotation.XmlElement;
 import org.opengis.metadata.content.TransferFunctionType;
 import org.apache.sis.internal.jaxb.gmd.CodeListAdapter;
-import org.apache.sis.internal.jaxb.gmd.CodeListProxy;
+import org.apache.sis.internal.jaxb.gmd.CodeListUID;
 import org.apache.sis.xml.Namespaces;
 
 
@@ -43,10 +43,10 @@ public final class MI_TransferFunctionTy
     }
 
     /**
-     * Creates a new adapter for the given proxy.
+     * Creates a new adapter for the given value.
      */
-    private MI_TransferFunctionTypeCode(final CodeListProxy proxy) {
-        super(proxy);
+    private MI_TransferFunctionTypeCode(final CodeListUID value) {
+        super(value);
     }
 
     /**
@@ -55,8 +55,8 @@ public final class MI_TransferFunctionTy
      * @return The wrapper for the code list value.
      */
     @Override
-    protected MI_TransferFunctionTypeCode wrap(CodeListProxy proxy) {
-        return new MI_TransferFunctionTypeCode(proxy);
+    protected MI_TransferFunctionTypeCode wrap(final CodeListUID value) {
+        return new MI_TransferFunctionTypeCode(value);
     }
 
     /**
@@ -76,16 +76,16 @@ public final class MI_TransferFunctionTy
      */
     @Override
     @XmlElement(name = "MI_TransferFunctionTypeCode", namespace = Namespaces.GMI)
-    public CodeListProxy getElement() {
-        return proxy;
+    public CodeListUID getElement() {
+        return identifier;
     }
 
     /**
      * Invoked by JAXB on unmarshalling.
      *
-     * @param proxy The unmarshalled value.
+     * @param value The unmarshalled value.
      */
-    public void setElement(final CodeListProxy proxy) {
-        this.proxy = proxy;
+    public void setElement(final CodeListUID value) {
+        identifier = value;
     }
 }

Modified: sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/code/MI_TriggerCode.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/code/MI_TriggerCode.java?rev=1710256&r1=1710255&r2=1710256&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/code/MI_TriggerCode.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/code/MI_TriggerCode.java [UTF-8] Fri Oct 23 16:04:17 2015
@@ -19,7 +19,7 @@ package org.apache.sis.internal.jaxb.cod
 import javax.xml.bind.annotation.XmlElement;
 import org.opengis.metadata.acquisition.Trigger;
 import org.apache.sis.internal.jaxb.gmd.CodeListAdapter;
-import org.apache.sis.internal.jaxb.gmd.CodeListProxy;
+import org.apache.sis.internal.jaxb.gmd.CodeListUID;
 import org.apache.sis.xml.Namespaces;
 
 
@@ -41,10 +41,10 @@ public final class MI_TriggerCode extend
     }
 
     /**
-     * Creates a new adapter for the given proxy.
+     * Creates a new adapter for the given value.
      */
-    private MI_TriggerCode(final CodeListProxy proxy) {
-        super(proxy);
+    private MI_TriggerCode(final CodeListUID value) {
+        super(value);
     }
 
     /**
@@ -53,8 +53,8 @@ public final class MI_TriggerCode extend
      * @return The wrapper for the code list value.
      */
     @Override
-    protected MI_TriggerCode wrap(CodeListProxy proxy) {
-        return new MI_TriggerCode(proxy);
+    protected MI_TriggerCode wrap(final CodeListUID value) {
+        return new MI_TriggerCode(value);
     }
 
     /**
@@ -74,16 +74,16 @@ public final class MI_TriggerCode extend
      */
     @Override
     @XmlElement(name = "MI_TriggerCode", namespace = Namespaces.GMI)
-    public CodeListProxy getElement() {
-        return proxy;
+    public CodeListUID getElement() {
+        return identifier;
     }
 
     /**
      * Invoked by JAXB on unmarshalling.
      *
-     * @param proxy The unmarshalled value.
+     * @param value The unmarshalled value.
      */
-    public void setElement(final CodeListProxy proxy) {
-        this.proxy = proxy;
+    public void setElement(final CodeListUID value) {
+        identifier = value;
     }
 }

Modified: sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/code/SV_CouplingType.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/code/SV_CouplingType.java?rev=1710256&r1=1710255&r2=1710256&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/code/SV_CouplingType.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/code/SV_CouplingType.java [UTF-8] Fri Oct 23 16:04:17 2015
@@ -19,7 +19,7 @@ package org.apache.sis.internal.jaxb.cod
 import javax.xml.bind.annotation.XmlElement;
 import org.opengis.metadata.identification.CouplingType;
 import org.apache.sis.internal.jaxb.gmd.CodeListAdapter;
-import org.apache.sis.internal.jaxb.gmd.CodeListProxy;
+import org.apache.sis.internal.jaxb.gmd.CodeListUID;
 import org.apache.sis.xml.Namespaces;
 
 
@@ -41,10 +41,10 @@ public final class SV_CouplingType exten
     }
 
     /**
-     * Creates a new adapter for the given proxy.
+     * Creates a new adapter for the given value.
      */
-    private SV_CouplingType(final CodeListProxy proxy) {
-        super(proxy);
+    private SV_CouplingType(final CodeListUID value) {
+        super(value);
     }
 
     /**
@@ -53,8 +53,8 @@ public final class SV_CouplingType exten
      * @return The wrapper for the code list value.
      */
     @Override
-    protected SV_CouplingType wrap(CodeListProxy proxy) {
-        return new SV_CouplingType(proxy);
+    protected SV_CouplingType wrap(final CodeListUID value) {
+        return new SV_CouplingType(value);
     }
 
     /**
@@ -74,16 +74,16 @@ public final class SV_CouplingType exten
      */
     @Override
     @XmlElement(name = "SV_CouplingType", namespace = Namespaces.SRV)
-    public CodeListProxy getElement() {
-        return proxy;
+    public CodeListUID getElement() {
+        return identifier;
     }
 
     /**
      * Invoked by JAXB on unmarshalling.
      *
-     * @param proxy The unmarshalled value.
+     * @param value The unmarshalled value.
      */
-    public void setElement(final CodeListProxy proxy) {
-        this.proxy = proxy;
+    public void setElement(final CodeListUID value) {
+        identifier = value;
     }
 }

Modified: sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MD_Identifier.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MD_Identifier.java?rev=1710256&r1=1710255&r2=1710256&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MD_Identifier.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MD_Identifier.java [UTF-8] Fri Oct 23 16:04:17 2015
@@ -16,8 +16,8 @@
  */
 package org.apache.sis.internal.jaxb.metadata;
 
-import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlElementRef;
+import javax.xml.bind.annotation.XmlElementRefs;
 import org.opengis.metadata.Identifier;
 import org.opengis.referencing.ReferenceIdentifier;
 import org.apache.sis.metadata.iso.DefaultIdentifier;
@@ -32,7 +32,7 @@ import org.apache.sis.internal.jaxb.gco.
  * @author  Cédric Briançon (Geomatys)
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.3
- * @version 0.5
+ * @version 0.7
  * @module
  */
 public final class MD_Identifier extends PropertyType<MD_Identifier, Identifier> {
@@ -74,45 +74,25 @@ public final class MD_Identifier extends
     }
 
     /**
-     * Returns {@code true} if the identifier should be marshalled as a
-     * {@code RS_Identifier} instead than {@code MD_Identifier}.
-     */
-    @SuppressWarnings("deprecation")
-    private boolean isRS() {
-        return (metadata instanceof ReferenceIdentifier) || (metadata instanceof ImmutableIdentifier);
-    }
-
-    /**
      * Invoked by JAXB at marshalling time for getting the actual metadata to write
-     * inside the {@code <gmd:MD_Identifier>} XML element.
+     * inside the {@code <gmd:MD_Identifier>} or {@code RS_Identifier} XML element.
      * This is the value or a copy of the value given in argument to the {@code wrap} method.
      *
      * @return The metadata to be marshalled.
      */
-    @XmlElementRef
-    public DefaultIdentifier getElement() {
-        return isRS() ? null : DefaultIdentifier.castOrCopy(metadata);
-    }
-
-    /**
-     * Invoked by JAXB at unmarshalling time for storing the result temporarily.
-     *
-     * @param metadata The unmarshalled metadata.
-     */
-    public void setElement(final DefaultIdentifier metadata) {
-        this.metadata = metadata;
-    }
-
-    /**
-     * An alternative to {@link #getElement()} when the metadata is actually
-     * an instance of {@link ReferenceIdentifier}. In such case, the enclosing
-     * XML element will be {@code RS_Identifier} instead of {@code MD_Identifier}.
-     *
-     * @return The metadata to be marshalled.
-     */
-    @XmlElement(name = "RS_Identifier")
-    public ImmutableIdentifier getReferenceIdentifier() {
-        return isRS() ? ImmutableIdentifier.castOrCopy(metadata) : null;
+    @XmlElementRefs({
+        @XmlElementRef(type = DefaultIdentifier.class),
+        @XmlElementRef(type = ImmutableIdentifier.class)
+    })
+    @SuppressWarnings("deprecation")
+    public Identifier getElement() {
+        if (metadata instanceof ImmutableIdentifier) {
+            return (ImmutableIdentifier) metadata;
+        }
+        if (metadata instanceof ReferenceIdentifier) {
+            return ImmutableIdentifier.castOrCopy(metadata);
+        }
+        return DefaultIdentifier.castOrCopy(metadata);
     }
 
     /**
@@ -120,7 +100,7 @@ public final class MD_Identifier extends
      *
      * @param metadata The unmarshalled metadata.
      */
-    public void setReferenceIdentifier(final ImmutableIdentifier metadata) {
+    public void setElement(final Identifier metadata) {
         this.metadata = metadata;
     }
 }

Modified: sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/package-info.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/package-info.java?rev=1710256&r1=1710255&r2=1710256&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/package-info.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/package-info.java [UTF-8] Fri Oct 23 16:04:17 2015
@@ -50,7 +50,7 @@
  * @author  Cédric Briançon (Geomatys)
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.3
- * @version 0.3
+ * @version 0.5
  * @module
  *
  * @see javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter

Modified: sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/package-info.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/package-info.java?rev=1710256&r1=1710255&r2=1710256&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/package-info.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/package-info.java [UTF-8] Fri Oct 23 16:04:17 2015
@@ -25,7 +25,7 @@
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.3
- * @version 0.3
+ * @version 0.7
  * @module
  */
 package org.apache.sis.internal.metadata;

Modified: sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/test/suite/MetadataTestSuite.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/test/suite/MetadataTestSuite.java?rev=1710256&r1=1710255&r2=1710256&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/test/suite/MetadataTestSuite.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/test/suite/MetadataTestSuite.java [UTF-8] Fri Oct 23 16:04:17 2015
@@ -59,7 +59,7 @@ import org.junit.BeforeClass;
     org.apache.sis.internal.jaxb.code.PT_LocaleTest.class,
     org.apache.sis.xml.FreeTextMarshallingTest.class,
     org.apache.sis.xml.NilReasonMarshallingTest.class,
-    org.apache.sis.xml.AnchorMarshallingTest.class,
+    org.apache.sis.xml.CharSequenceSubstitutionTest.class,
     org.apache.sis.xml.UUIDMarshallingTest.class,
     org.apache.sis.xml.XLinkMarshallingTest.class,
 

Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/CharSequenceAdapter.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/CharSequenceAdapter.java?rev=1710256&r1=1710255&r2=1710256&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/CharSequenceAdapter.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/CharSequenceAdapter.java [UTF-8] Fri Oct 23 16:04:17 2015
@@ -85,9 +85,9 @@ public final class CharSequenceAdapter e
      * @param  value The character representation of the object being marshalled.
      * @return The wrapper for the given character sequence, or {@code null}.
      */
-    public static GO_CharacterString wrap(CharSequence value) {
+    static GO_CharacterString wrap(CharSequence value) {
         if (value instanceof String) {
-            return wrap(Context.current(), value, (String) value); // Slightly more efficient variant of this method.
+            return wrap(Context.current(), value, (String) value);  // Slightly more efficient variant of this method.
         }
         /*
          * <gmd:someElement xsi:type="gmd:PT_FreeText_PropertyType">

Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_CharacterString.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_CharacterString.java?rev=1710256&r1=1710255&r2=1710256&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_CharacterString.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_CharacterString.java [UTF-8] Fri Oct 23 16:04:17 2015
@@ -16,16 +16,27 @@
  */
 package org.apache.sis.internal.jaxb.gco;
 
+import javax.xml.XMLConstants;
+import javax.xml.namespace.QName;
+import javax.xml.bind.JAXBElement;
 import javax.xml.bind.annotation.XmlType;
 import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlSchemaType;
+import javax.xml.bind.annotation.XmlElements;
+import javax.xml.bind.annotation.XmlAnyElement;
 import javax.xml.bind.annotation.XmlSeeAlso;
+import org.w3c.dom.Element;
+import org.opengis.util.CodeList;
+import org.opengis.util.ControlledVocabulary;
 import org.apache.sis.xml.Namespaces;
 import org.apache.sis.internal.jaxb.Context;
 import org.apache.sis.internal.jaxb.gmx.Anchor;
 import org.apache.sis.internal.jaxb.gmx.FileName;
 import org.apache.sis.internal.jaxb.gmx.MimeFileType;
+import org.apache.sis.internal.jaxb.gmd.CodeListUID;
 import org.apache.sis.util.CharSequences;
+import org.apache.sis.util.Workaround;
+import org.apache.sis.util.iso.Types;
+import org.apache.sis.util.resources.Errors;
 import org.apache.sis.util.resources.Messages;
 
 
@@ -39,9 +50,13 @@ import org.apache.sis.util.resources.Mes
  * Consequently we unconditionally accept {@code FileName} and {@code MimeFileType} at unmarshalling time.
  * However marshalling will use the appropriate element for the kind of property to marshal.</p>
  *
+ * <p>{@code <gco:CharacterString>} can also be replaced by {@link org.opengis.util.CodeList} or some
+ * {@link java.lang.Enum} instances. See {@link Types} javadoc for an example.</p>
+ *
  * @author  Cédric Briançon (Geomatys)
+ * @author  Martin Desruisseaux (Geomatys)
  * @since   0.3
- * @version 0.6
+ * @version 0.7
  * @module
  *
  * @see org.apache.sis.internal.jaxb.gmd.PT_FreeText
@@ -71,11 +86,17 @@ public class GO_CharacterString {
 
     /**
      * Value assigned to {@link #type} if the current {@link #text}
-     * has been found in a {@code <gco:CharacterString>} element.
+     * has been found in a {@code <gmx:Anchor>} element.
      */
     private static final byte ANCHOR = 3;
 
     /**
+     * Value assigned to {@link #type} if the current {@link #text}
+     * has been found in an enumeration or code list element.
+     */
+    private static final byte ENUM = 4;
+
+    /**
      * The XML element names for each possible {@link #type} values.
      * Used for formatting error messages.
      */
@@ -85,18 +106,24 @@ public class GO_CharacterString {
             case MIME_TYPE: return "MimeFileType";
             case FILENAME:  return "FileName";
             case ANCHOR:    return "Anchor";
+            case ENUM:      return "ControlledVocabulary";
             default:        throw new AssertionError(type);
         }
     }
 
     /**
-     * The text or anchor value, or {@code null} if none. May be an instance
-     * of {@link Anchor}, which needs to be handled in a special way.
+     * The text, code list or anchor value, or {@code null} if none.
+     * The following types need to be handled in a special way:
+     *
+     * <ul>
+     *   <li>{@link Anchor}</li>
+     *   <li>Instances for which {@link Types#forCodeTitle(CharSequence)} returns a non-null value.</li>
+     * </ul>
      */
     private CharSequence text;
 
     /**
-     * 0 if the text shall be marshalled as a {@code <gco:CharacterString>} or an anchor,
+     * 0 if the text shall be marshalled as a {@code <gco:CharacterString>},
      * or one of the static constants in this class otherwise.
      *
      * @see #FILENAME
@@ -107,7 +134,7 @@ public class GO_CharacterString {
     /**
      * Empty constructor for JAXB and subclasses.
      */
-    public GO_CharacterString() {
+    protected GO_CharacterString() {
     }
 
     /**
@@ -117,6 +144,11 @@ public class GO_CharacterString {
      */
     protected GO_CharacterString(final CharSequence text) {
         this.text = text;
+        if (text instanceof Anchor) {
+            type = ANCHOR;
+        } else if (Types.forCodeTitle(text) != null) {
+            type = ENUM;
+        }
     }
 
     /**
@@ -126,136 +158,147 @@ public class GO_CharacterString {
      * @param value    The value to set.
      * @param property 0 or one of the {@link #MIME_TYPE}, {@link #FILENAME} or {@link #ANCHOR} constants.
      */
-    private void setText(final CharSequence value, byte property) {
-        if (text != null && !value.equals(text)) {
-            /*
-             * The given value overwrite a previous one. Determine which value will be discarded
-             * using the 'type' value as a criterion, then emit a warning.
-             */
-            byte discarded = type;
-            boolean noset = false;
-            if (discarded > property) {
-                discarded = property;
-                property  = type;
-                noset     = true;
-            }
-            Context.warningOccured(Context.current(), getClass(), "setText", Messages.class,
-                    Messages.Keys.DiscardedExclusiveProperty_2, nameOf(discarded), nameOf(property));
-            if (noset) {
-                return;
+    private void setText(CharSequence value, byte property) {
+        value = CharSequences.trimWhitespaces(value);
+        if (value != null && value.length() != 0) {
+            if (text != null && !value.equals(text)) {
+                /*
+                 * The given value overwrite a previous one. Determine which value will be discarded
+                 * using the 'type' value as a criterion, then emit a warning.
+                 */
+                byte discarded = type;
+                boolean noset = false;
+                if (discarded > property) {
+                    discarded = property;
+                    property  = type;
+                    noset     = true;
+                }
+                Context.warningOccured(Context.current(), getClass(), "setText", Messages.class,
+                        Messages.Keys.DiscardedExclusiveProperty_2, nameOf(discarded), nameOf(property));
+                if (noset) {
+                    return;
+                }
             }
+            text = value;
+            type = property;
         }
-        text = value;
-        type = property;
     }
 
     /**
-     * Returns the text in a {@code <gco:CharacterString>} element, or {@code null} if none.
+     * Returns the text in a {@code <gco:CharacterString>}, {@code <gmx:FileName>} or {@code <gmx:MimeFileType>}
+     * element, or {@code null} if none. This method does not return anything for {@code Enum} or {@code CodeList}
+     * instances, as the later are handled by {@link #getCodeList()}.
      *
-     * @return The text, or {@code null}.
+     * <p>This method is invoked by JAXB at marshalling time and should not need to be invoked directly.</p>
      */
-    @XmlSchemaType(name = "string")         // Not needed, but declared as a matter of principle.
-    @XmlElement(name = "CharacterString")
-    public final String getCharacterString() {
-        return (type == 0 && !(text instanceof Anchor)) ? StringAdapter.toString(text) : null;
-    }
-
-    /**
-     * Sets the value to the given string. This method is called by JAXB at unmarshalling time.
-     *
-     * @param value The new text.
-     */
-    public final void setCharacterString(String value) {
-        value = CharSequences.trimWhitespaces(value);
-        if (value != null && !value.isEmpty()) {
-            setText(value, (byte) 0);
+    @XmlElements({
+        @XmlElement(type = String.class,       name = "CharacterString"),
+        @XmlElement(type = Anchor.class,       name = "Anchor",       namespace = Namespaces.GMX),
+        @XmlElement(type = FileName.class,     name = "FileName",     namespace = Namespaces.GMX),
+        @XmlElement(type = MimeFileType.class, name = "MimeFileType", namespace = Namespaces.GMX)
+    })
+    private Object getValue() {
+        switch (type) {
+            case 0:         return StringAdapter.toString(text);
+            case FILENAME:  return new FileName(text.toString());
+            case MIME_TYPE: return new MimeFileType(text.toString());
+            case ANCHOR:    return text;    // Shall be an instance of Anchor.
+            default:        return null;    // CodeList or Enum.
         }
     }
 
     /**
-     * Returns the text in a {@code <gmx:FileName>} element, or {@code null} if none.
+     * Sets the {@code <gco:CharacterString>}, {@code <gmx:FileName>} or {@code <gmx:MimeFileType>} value.
+     *
+     * <p>This method is invoked by JAXB at unmarshalling time and should not need to be invoked directly.</p>
      */
-    @XmlElement(name = "FileName", namespace = Namespaces.GMX)
-    final FileName getFileName() {
-        if (type == FILENAME) {
-            final CharSequence text = this.text;
-            if (text != null && !(text instanceof Anchor)) {
-                return new FileName(text.toString());
-            }
+    private void setValue(final Object value) {
+        if (value instanceof Anchor) {
+            setText((Anchor) value, ANCHOR);
+        } else if (value instanceof FileName) {
+            setText(value.toString(), FILENAME);
+        } else if (value instanceof MimeFileType) {
+            setText(value.toString(), MIME_TYPE);
+        } else {
+            setText((CharSequence) value, (byte) 0);
         }
-        return null;
     }
 
     /**
-     * Invoked by JAXB for setting the filename.
+     * Returns the code list wrapped in a JAXB element, or {@code null} if the {@link #text} is not a wrapper for
+     * a code list. Only one of {@link #getValue()} and {@code getCodeList()} should return a non-null value.
+     *
+     * <div class="note"><b>Note:</b>
+     * we have to rely on a somewhat complicated mechanism because the code lists implementations in GeoAPI
+     * do not hae JAXB annotations. If those annotations are added in a future GeoAPI implementation, then
+     * we could replace this mechanism by a simple property annotated with {@code XmlElementRef}.</div>
+     *
+     * @since 0.7
      */
-    final void setFileName(final FileName file) {
-        if (file != null) {
-            final String value = CharSequences.trimWhitespaces(file.toString());
-            if (value != null && !value.isEmpty()) {
-                setText(value, FILENAME);
-            }
+    @XmlAnyElement
+    @Workaround(library = "GeoAPI", version = "3.0")
+    private Object getCodeList() {
+        if (type != ENUM) {
+            return null;
         }
-    }
-
-    /**
-     * Returns the text in a {@code <gmx:MimeFileType>} element, or {@code null} if none.
-     */
-    @XmlElement(name = "MimeFileType", namespace = Namespaces.GMX)
-    final MimeFileType getMimeFileType() {
-        if (type == MIME_TYPE) {
-            final CharSequence text = this.text;
-            if (text != null && !(text instanceof Anchor)) {
-                return new MimeFileType(text.toString());
-            }
+        final ControlledVocabulary code = Types.forCodeTitle(text);
+        final String name = Types.getListName(code);
+        final String namespace;
+        /*
+         * The namespace is usually GMD, but we also have some other namespaces link GMI.
+         * The real namespace is declared in the @XmlElement annotation of the getElement
+         * method in the JAXB adapter. We could use reflection, but we do not in order to
+         * avoid potential class loading issue and also because not all CodeList are in the
+         * same package.
+         */
+        if (name.startsWith("MD_") || name.startsWith("CI_") || name.startsWith("DS_")) {
+            namespace = Namespaces.GMD;
+        } else if (name.startsWith("MI_")) {
+            namespace = Namespaces.GMI;
+        } else if (name.startsWith("SV_") || name.equals("DCPList")) {
+            namespace = Namespaces.SRV;
+        } else if (name.startsWith("CS_") || name.startsWith("CD_") || name.startsWith("SC_")) {
+            namespace = Namespaces.GML;
+        } else {
+            namespace = XMLConstants.NULL_NS_URI;
         }
-        return null;
+        return new JAXBElement<>(new QName(namespace, name), CodeListUID.class,
+                new CodeListUID(Context.current(), code));
     }
 
     /**
-     * Invoked by JAXB for setting the MIME type.
-     */
-    final void setMimeFileType(final MimeFileType type) {
-        if (type != null) {
-            final String value = CharSequences.trimWhitespaces(type.toString());
-            if (value != null && !value.isEmpty()) {
-                setText(value, MIME_TYPE);
+     * Invoked by JAXB for any XML element which is not a {@code <gco:CharacterString>}, {@code <gmx:FileName>}
+     * or {@code <gmx:MimeFileType>}. This method presumes that the element name is the CodeList standard name.
+     * If not, the element will be ignored.
+     */
+    @SuppressWarnings("unchecked")
+    private void setCodeList(final Object value) {
+        final Element e = (Element) value;
+        if (e.getNodeType() == Element.ELEMENT_NODE) {
+            final Class<?> ct = Types.forStandardName(e.getLocalName());
+            if (ct != null && CodeList.class.isAssignableFrom(ct)) {
+                final String attribute = e.getAttribute("codeListValue");
+                if (!attribute.isEmpty()) {
+                    text = Types.getCodeTitle(Types.forCodeName((Class) ct, attribute, true));
+                    type = ENUM;
+                    return;
+                }
             }
+            Context.warningOccured(Context.current(), GO_CharacterString.class, "setCodeList",
+                    Errors.class, Errors.Keys.UnknownType_1, e.getNodeName());
         }
     }
 
     /**
-     * Returns the text associated with a reference.
-     * This method is called by JAXB at marshalling time.
-     *
-     * @return The anchor, or {@code null}.
-     */
-    @XmlElement(name = "Anchor", namespace = Namespaces.GMX)
-    public final Anchor getAnchor() {
-        final CharSequence text = this.text;
-        return (text instanceof Anchor) ? (Anchor) text : null;
-    }
-
-    /**
-     * Sets the value for the metadata string.
-     * This method is called by JAXB at unmarshalling time.
-     *
-     * @param anchor The new anchor.
-     */
-    public final void setAnchor(final Anchor anchor) {
-        setText(anchor, ANCHOR);
-    }
-
-    /**
      * Returns the content of this {@code <gco:CharacterString>} as a {@code String},
      * an {@code InternationalString} or an {@code Anchor}. This method is overridden
      * by {@code PT_FreeText} in order to handle the international string case.
      *
      * @return The character sequence for this {@code <gco:CharacterString>}.
      */
-    public CharSequence toCharSequence() {
+    protected CharSequence toCharSequence() {
         final CharSequence text = CharSequences.trimWhitespaces(this.text);
-        if (text != null && (text.length() != 0 || text instanceof Anchor)) { // Anchor may contain attributes.
+        if (text != null && (text.length() != 0 || text instanceof Anchor)) {       // Anchor may contain attributes.
             return text;
         }
         return null;
@@ -275,6 +318,6 @@ public class GO_CharacterString {
     @Override
     public final String toString() {
         final CharSequence text = this.text;
-        return (text != null) ? text.toString() : null; // NOSONAR: Really want to return null.
+        return (text != null) ? text.toString() : null;     // We really want to return null here.
     }
 }

Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/StringAdapter.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/StringAdapter.java?rev=1710256&r1=1710255&r2=1710256&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/StringAdapter.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/StringAdapter.java [UTF-8] Fri Oct 23 16:04:17 2015
@@ -38,7 +38,7 @@ public class StringAdapter extends XmlAd
     /**
      * Empty constructor for JAXB or subclasses.
      */
-    public StringAdapter() {
+    protected StringAdapter() {
     }
 
     /**
@@ -78,7 +78,7 @@ public class StringAdapter extends XmlAd
      * @param  value The wrapper for the value, or {@code null}.
      * @return The string representation of the given text, or {@code null}.
      */
-    public static String toString(final GO_CharacterString value) {
+    static String toString(final GO_CharacterString value) {
         return (value != null) ? toString(value.toCharSequence()) : null;
     }
 

Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/URIAdapter.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/URIAdapter.java?rev=1710256&r1=1710255&r2=1710256&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/URIAdapter.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/URIAdapter.java [UTF-8] Fri Oct 23 16:04:17 2015
@@ -68,7 +68,7 @@ public final class URIAdapter extends Xm
         if (value != null) {
             final Context context = Context.current();
             final GO_CharacterString wrapper = CharSequenceAdapter.wrap(context, value, value.toString());
-            if (wrapper != null) {
+            if (wrapper != null && wrapper.type == 0) {
                 if (!Context.isFlagSet(context, Context.SUBSTITUTE_FILENAME)) {
                     wrapper.type = GO_CharacterString.FILENAME;
                 }

Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/package-info.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/package-info.java?rev=1710256&r1=1710255&r2=1710256&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/package-info.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/package-info.java [UTF-8] Fri Oct 23 16:04:17 2015
@@ -78,7 +78,7 @@
  * @author  Cédric Briançon (Geomatys)
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.3
- * @version 0.4
+ * @version 0.7
  * @module
  *
  * @see javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter

Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/CodeListAdapter.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/CodeListAdapter.java?rev=1710256&r1=1710255&r2=1710256&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/CodeListAdapter.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/CodeListAdapter.java [UTF-8] Fri Oct 23 16:04:17 2015
@@ -24,8 +24,8 @@ import org.apache.sis.internal.jaxb.Cont
 
 /**
  * An adapter for {@link CodeList}, in order to implement the ISO-19139 standard. This object
- * wraps a {@link CodeListProxy}, which contain {@link CodeListProxy#codeList codeList} and
- * {@link CodeListProxy#codeListValue codeListValue} attributes. The result looks like below:
+ * wraps a {@link CodeListUID}, which contain {@link CodeListUID#codeList codeList} and
+ * {@link CodeListUID#codeListValue codeListValue} attributes. The result looks like below:
  *
  * {@preformat xml
  *   <dateType>
@@ -51,9 +51,9 @@ public abstract class CodeListAdapter<Va
         BoundType extends CodeList<BoundType>> extends XmlAdapter<ValueType,BoundType>
 {
     /**
-     * A proxy form of the {@link CodeList}.
+     * The value of the {@link CodeList}.
      */
-    protected CodeListProxy proxy;
+    protected CodeListUID identifier;
 
     /**
      * Empty constructor for subclasses only.
@@ -64,28 +64,28 @@ public abstract class CodeListAdapter<Va
     /**
      * Creates a wrapper for a {@link CodeList}, in order to handle the format specified in ISO-19139.
      *
-     * @param proxy The proxy version of {@link CodeList} to be marshalled.
+     * @param value The value of {@link CodeList} to be marshalled.
      */
-    protected CodeListAdapter(final CodeListProxy proxy) {
-        this.proxy = proxy;
+    protected CodeListAdapter(final CodeListUID value) {
+        identifier = value;
     }
 
     /**
-     * Wraps the proxy value into an adapter.
+     * Wraps the given value.
      * Most implementations will be like below:
      *
      * {@preformat java
-     *     return new ValueType(proxy);
+     *     return new ValueType(value);
      * }
      *
-     * However is some cases, the {@code proxy} argument may be inspected.
+     * However is some cases, the {@code value} argument may be inspected.
      * For example {@link org.apache.sis.internal.jaxb.code.MD_RestrictionCode}
      * replaces {@code "licence"} by {@code "license"} for ISO 19115:2003 compatibility.
      *
-     * @param proxy The proxy version of {@link CodeList}, to be marshalled.
+     * @param value The value of {@link CodeList}, to be marshalled.
      * @return The wrapper for the code list value.
      */
-    protected abstract ValueType wrap(final CodeListProxy proxy);
+    protected abstract ValueType wrap(CodeListUID value);
 
     /**
      * Returns the class of code list wrapped by this adapter.
@@ -103,19 +103,19 @@ public abstract class CodeListAdapter<Va
      */
     @Override
     public final BoundType unmarshal(final ValueType adapter) {
-        return (adapter != null) ? Types.forCodeName(getCodeListClass(), adapter.proxy.identifier(), true) : null;
+        return (adapter != null) ? Types.forCodeName(getCodeListClass(), adapter.identifier.toString(), true) : null;
     }
 
     /**
      * Substitutes the code list by the adapter to be marshalled into an XML file
      * or stream. JAXB calls automatically this method at marshalling time.
      *
-     * @param  value The code list value.
+     * @param  code The code list value.
      * @return The adapter for the given code list.
      */
     @Override
-    public final ValueType marshal(final BoundType value) {
-        return (value != null) ? wrap(new CodeListProxy(Context.current(), value)) : null;
+    public final ValueType marshal(final BoundType code) {
+        return (code != null) ? wrap(new CodeListUID(Context.current(), code)) : null;
     }
 
     /**
@@ -124,7 +124,7 @@ public abstract class CodeListAdapter<Va
      *
      * @return The {@code CodeList} value to be marshalled.
      */
-    public abstract CodeListProxy getElement();
+    public abstract CodeListUID getElement();
 
     /*
      * We do not define setter method (even abstract) since it seems to confuse JAXB.

Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/Country.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/Country.java?rev=1710256&r1=1710255&r2=1710256&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/Country.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/Country.java [UTF-8] Fri Oct 23 16:04:17 2015
@@ -53,12 +53,12 @@ public final class Country extends GO_Ch
      * The country using a {@link org.opengis.util.CodeList}-like format.
      */
     @XmlElement(name = "Country")
-    private CodeListProxy proxy;
+    private CodeListUID identifier;
 
     /**
      * Empty constructor for JAXB only.
      */
-    public Country() {
+    private Country() {
     }
 
     /**
@@ -79,7 +79,7 @@ public final class Country extends GO_Ch
      * @param value         The value in the language specified by the {@code codeSpace} attribute, or {@code null} if none.
      */
     private Country(final Context context, final String codeListValue, final String codeSpace, final String value) {
-        proxy = new CodeListProxy(context, "Country", codeListValue, codeSpace, value);
+        identifier = new CodeListUID(context, "Country", codeListValue, codeSpace, value);
     }
 
     /**
@@ -134,8 +134,8 @@ public final class Country extends GO_Ch
             code = language.getLanguage();
         }
         if (country != null) {
-            final CodeListProxy proxy = country.proxy;
-            final String c = CharSequences.trimWhitespaces(proxy != null ? proxy.identifier() : country.toString());
+            final CodeListUID identifier = country.identifier;
+            final String c = CharSequences.trimWhitespaces((identifier != null ? identifier : country).toString());
             if (c != null && !c.isEmpty()) {
                 if (code == null) {
                     code = "";

Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/LanguageCode.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/LanguageCode.java?rev=1710256&r1=1710255&r2=1710256&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/LanguageCode.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/LanguageCode.java [UTF-8] Fri Oct 23 16:04:17 2015
@@ -51,12 +51,12 @@ public final class LanguageCode extends
      * The language using a {@link org.opengis.util.CodeList}-like format.
      */
     @XmlElement(name = "LanguageCode")
-    private CodeListProxy proxy;
+    private CodeListUID identifier;
 
     /**
      * Empty constructor for JAXB only.
      */
-    public LanguageCode() {
+    private LanguageCode() {
     }
 
     /**
@@ -77,7 +77,7 @@ public final class LanguageCode extends
      * @param value         The value in the language specified by the {@code codeSpace} attribute, or {@code null} if none.
      */
     private LanguageCode(final Context context, final String codeListValue, final String codeSpace, final String value) {
-        proxy = new CodeListProxy(context, "LanguageCode", codeListValue, codeSpace, value);
+        identifier = new CodeListUID(context, "LanguageCode", codeListValue, codeSpace, value);
     }
 
     /**
@@ -136,14 +136,13 @@ public final class LanguageCode extends
      */
     public String getLanguage() {
         String code;
-        final CodeListProxy proxy = this.proxy;
-        if (proxy != null) {
+        if (identifier != null) {
             /*
              * <gmd:language>
              *   <gmd:LanguageCode codeList="(snip)#LanguageCode" codeListValue="jpn">Japanese</gmd:LanguageCode>
              * </gmd:language>
              */
-            code = proxy.identifier(); // May still be null.
+            code = identifier.toString(); // May still be null.
         } else {
             /*
              * <gmd:language>

Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/PT_FreeText.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/PT_FreeText.java?rev=1710256&r1=1710255&r2=1710256&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/PT_FreeText.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/PT_FreeText.java [UTF-8] Fri Oct 23 16:04:17 2015
@@ -169,7 +169,7 @@ public final class PT_FreeText extends G
      * @return The character sequence for this {@code <gco:CharacterString>}.
      */
     @Override
-    public CharSequence toCharSequence() {
+    protected CharSequence toCharSequence() {
         String defaultValue = toString(); // May be null.
         if (defaultValue != null && contains(defaultValue)) {
             /*

Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/package-info.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/package-info.java?rev=1710256&r1=1710255&r2=1710256&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/package-info.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/package-info.java [UTF-8] Fri Oct 23 16:04:17 2015
@@ -22,7 +22,7 @@
  *
  * @author  Cédric Briançon (Geomatys)
  * @since   0.3
- * @version 0.3
+ * @version 0.7
  * @module
  *
  * @see javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter

Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gml/CodeListAdapter.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gml/CodeListAdapter.java?rev=1710256&r1=1710255&r2=1710256&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gml/CodeListAdapter.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gml/CodeListAdapter.java [UTF-8] Fri Oct 23 16:04:17 2015
@@ -33,7 +33,7 @@ import org.apache.sis.util.iso.Types;
  * @version 0.3
  * @module
  */
-public abstract class CodeListAdapter<BoundType extends CodeList<BoundType>> extends XmlAdapter<CodeListProxy,BoundType> {
+public abstract class CodeListAdapter<BoundType extends CodeList<BoundType>> extends XmlAdapter<CodeListUID,BoundType> {
     /**
      * Empty constructor for subclasses only.
      */
@@ -61,23 +61,23 @@ public abstract class CodeListAdapter<Bo
      * Substitutes the adapter value read from an XML stream by the object which will
      * contain the value. JAXB calls automatically this method at unmarshalling time.
      *
-     * @param  proxy The proxy for the GML value.
+     * @param  identifier The code space and identifier.
      * @return A code list which represents the GML value.
      */
     @Override
-    public final BoundType unmarshal(final CodeListProxy proxy) {
-        return (proxy != null) ? Types.forCodeName(getCodeListClass(), proxy.identifier, true) : null;
+    public final BoundType unmarshal(final CodeListUID identifier) {
+        return (identifier != null) ? Types.forCodeName(getCodeListClass(), identifier.value, true) : null;
     }
 
     /**
      * Substitutes the code list by the proxy to be marshalled into an XML file
      * or stream. JAXB calls automatically this method at marshalling time.
      *
-     * @param  value The code list value.
+     * @param  code The code list value.
      * @return The proxy for the given code list.
      */
     @Override
-    public final CodeListProxy marshal(final BoundType value) {
-        return (value != null) ? new CodeListProxy(getCodeSpace(), value) : null;
+    public final CodeListUID marshal(final BoundType code) {
+        return (code != null) ? new CodeListUID(getCodeSpace(), code) : null;
     }
 }

Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmx/MimeFileTypeAdapter.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmx/MimeFileTypeAdapter.java?rev=1710256&r1=1710255&r2=1710256&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmx/MimeFileTypeAdapter.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmx/MimeFileTypeAdapter.java [UTF-8] Fri Oct 23 16:04:17 2015
@@ -48,7 +48,7 @@ public final class MimeFileTypeAdapter e
     public GO_CharacterString marshal(final String value) {
         final Context context = Context.current();
         final GO_CharacterString wrapper = CharSequenceAdapter.wrap(context, value, value);
-        if (wrapper != null) {
+        if (wrapper != null && wrapper.type == 0) {
             if (!Context.isFlagSet(context, Context.SUBSTITUTE_MIMETYPE)) {
                 wrapper.type = GO_CharacterString.MIME_TYPE;
             }

Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/iso/AbstractInternationalString.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/iso/AbstractInternationalString.java?rev=1710256&r1=1710255&r2=1710256&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/iso/AbstractInternationalString.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/iso/AbstractInternationalString.java [UTF-8] Fri Oct 23 16:04:17 2015
@@ -20,20 +20,31 @@ import java.util.Locale;
 import java.util.Formatter;
 import java.util.Formattable;
 import java.util.FormattableFlags;
+import org.opengis.util.ControlledVocabulary;
 import org.opengis.util.InternationalString;
 import org.apache.sis.internal.util.Utilities;
 import org.apache.sis.util.CharSequences;
 
 
 /**
- * Base class for {@linkplain String string}s that has been internationalized into several
- * {@linkplain Locale locales}. The {@link InternationalString} interface is used as a replacement
- * for the {@link String} class whenever an attribute needs to be internationalization capable.
- * The default value (as returned by {@link #toString()} and other {@link CharSequence} methods)
+ * Base class for character strings that has been internationalized into several locales.
+ * The {@link InternationalString} interface is used instead of the {@link String} class
+ * whenever an attribute needs to be internationalization capable.
+ *
+ * <p>The default value (as returned by {@link #toString()} and other {@link CharSequence} methods)
  * is the string in the current {@linkplain Locale#getDefault() system-wide default locale}.
+ * The {@linkplain Comparable natural ordering} is defined by the value returned by {@link #toString()}.</p>
+ *
+ * <div class="section">Substituting a free text by a code list</div>
+ * The ISO standard allows to substitute some character strings in the <cite>"free text"</cite> domain
+ * by a {@link org.opengis.util.CodeList} value. This can be done with:
  *
- * <p>The {@linkplain Comparable natural ordering} is defined by the value returned by
- * {@link #toString()}.</p>
+ * <ul>
+ *   <li>{@link Types#getCodeTitle(ControlledVocabulary)} for getting the {@link InternationalString}
+ *       instance to store in a metadata property.</li>
+ *   <li>{@link Types#forCodeTitle(CharSequence)} for retrieving the {@link org.opengis.util.CodeList}
+ *       previously stored as an {@code InternationalString}.</li>
+ * </ul>
  *
  * @author  Martin Desruisseaux (IRD, Geomatys)
  * @since   0.3

Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/iso/AbstractName.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/iso/AbstractName.java?rev=1710256&r1=1710255&r2=1710256&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/iso/AbstractName.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/iso/AbstractName.java [UTF-8] Fri Oct 23 16:04:17 2015
@@ -46,7 +46,7 @@ import java.util.Objects;
  * For example the above-cited strings can both be split into smaller name components.
  * If such finer grain control is desired, {@link DefaultNameFactory} can be used instead of {@link Names}.</p>
  *
- * <div class="section">{@code Comparable} ordering</div>
+ * <div class="section">Natural ordering</div>
  * This class has a natural ordering that is inconsistent with {@link #equals(Object)}.
  * See {@link #compareTo(GenericName)} for more information.
  *

Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultInternationalString.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultInternationalString.java?rev=1710256&r1=1710255&r2=1710256&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultInternationalString.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultInternationalString.java [UTF-8] Fri Oct 23 16:04:17 2015
@@ -34,16 +34,15 @@ import org.apache.sis.util.ArgumentCheck
 import org.apache.sis.util.logging.Logging;
 import org.apache.sis.util.resources.Errors;
 import org.apache.sis.util.resources.Messages;
+import org.apache.sis.util.collection.Containers;
 import org.apache.sis.internal.system.Modules;
 
-import static org.apache.sis.util.collection.Containers.isNullOrEmpty;
-
 // Branch-dependent imports
 import java.util.Objects;
 
 
 /**
- * An international string using a {@linkplain Map map} of strings for different locales.
+ * An international string using a map of strings for different locales.
  * Strings for new locales can be {@linkplain #add(Locale, String) added},
  * but existing strings can not be removed or modified.
  * This behavior is a compromise between making constructions easier, and being suitable for
@@ -111,7 +110,7 @@ public class DefaultInternationalString
      * @see Types#toInternationalString(Map, String)
      */
     public DefaultInternationalString(final Map<Locale,String> strings) {
-        if (isNullOrEmpty(strings)) {
+        if (Containers.isNullOrEmpty(strings)) {
             localeMap = Collections.emptyMap();
         } else {
             final Iterator<Map.Entry<Locale,String>> it = strings.entrySet().iterator();

Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/iso/ResourceInternationalString.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/iso/ResourceInternationalString.java?rev=1710256&r1=1710255&r2=1710256&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/iso/ResourceInternationalString.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/iso/ResourceInternationalString.java [UTF-8] Fri Oct 23 16:04:17 2015
@@ -21,8 +21,7 @@ import java.util.Locale;
 import java.util.Properties;
 import java.util.ResourceBundle;
 import java.util.MissingResourceException;
-
-import static org.apache.sis.util.ArgumentChecks.ensureNonNull;
+import org.apache.sis.util.ArgumentChecks;
 
 
 /**
@@ -36,8 +35,8 @@ import static org.apache.sis.util.Argume
  * See the {@link ResourceBundle#getBundle(String, Locale, ClassLoader) ResourceBundle.getBundle(…)}
  * Javadoc for more information.
  *
- * <div class="section">Example</div>
- * If a file named "{@code MyResources.properties}" exists in {@code org.mypackage}
+ * <div class="note"><b>Example:</b>
+ * if a file named "{@code MyResources.properties}" exists in {@code org.mypackage}
  * and contains the following line:
  *
  * {@preformat text
@@ -51,9 +50,10 @@ import static org.apache.sis.util.Argume
  * }
  *
  * The {@code "some value"} string will be localized if the required properties files exist, for
- * example "{@code MyResources_fr.properties}" for French, or "{@code MyResources_it.properties}"
+ * example "{@code MyResources_fr.properties}" for French or "{@code MyResources_it.properties}"
  * for Italian, <i>etc</i>.
  * If needed, users can gain more control by overriding the {@link #getBundle(Locale)} method.
+ * </div>
  *
  * <div class="section">Class loaders</div>
  * Developers can specify explicitely the {@link ClassLoader} to use be overriding the
@@ -111,10 +111,10 @@ public class ResourceInternationalString
      * @param key       The key for the resource to fetch.
      */
     public ResourceInternationalString(final String resources, final String key) {
+        ArgumentChecks.ensureNonNull("resources", resources);
+        ArgumentChecks.ensureNonNull("key",       key);
         this.resources = resources;
         this.key       = key;
-        ensureNonNull("resources", resources);
-        ensureNonNull("key",       key);
     }
 
     /**

Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/iso/SimpleInternationalString.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/iso/SimpleInternationalString.java?rev=1710256&r1=1710255&r2=1710256&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/iso/SimpleInternationalString.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/iso/SimpleInternationalString.java [UTF-8] Fri Oct 23 16:04:17 2015
@@ -21,8 +21,7 @@ import java.io.ObjectInputStream;
 import java.io.ObjectOutputStream;
 import java.io.Serializable;
 import java.util.Locale;
-
-import static org.apache.sis.util.ArgumentChecks.ensureNonNull;
+import org.apache.sis.util.ArgumentChecks;
 
 // Branch-dependent imports
 import java.util.Objects;
@@ -62,7 +61,7 @@ public class SimpleInternationalString e
      * @param text The string for all locales.
      */
     public SimpleInternationalString(final String text) {
-        ensureNonNull("text", text);
+        ArgumentChecks.ensureNonNull("text", text);
         defaultValue = text;
     }
 

Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/iso/Types.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/iso/Types.java?rev=1710256&r1=1710255&r2=1710256&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/iso/Types.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/iso/Types.java [UTF-8] Fri Oct 23 16:04:17 2015
@@ -42,23 +42,62 @@ import org.apache.sis.util.resources.Err
 import org.apache.sis.util.collection.BackingStoreException;
 import org.apache.sis.internal.system.Loggers;
 
+// Branch-dependent imports
+import org.apache.sis.internal.jdk8.JDK8;
+
 
 /**
  * Static methods working on GeoAPI types and {@link CodeList} values.
  * This class provides:
  *
  * <ul>
- *   <li>{@link #getStandardName(Class)}, {@link #getListName(ControlledVocabulary)} and
- *       {@link #getCodeName(ControlledVocabulary)} for fetching ISO names if possible.</li>
- *   <li>{@link #getCodeTitle(ControlledVocabulary)}, {@link #getDescription(ControlledVocabulary)} and
- *       {@link #getDescription(Class)} for fetching human-readable descriptions.</li>
- *   <li>{@link #forStandardName(String)} and {@link #forCodeName(Class, String, boolean)} for
- *       fetching an instance from a name (converse of above {@code get} methods).</li>
+ *   <li>Methods for fetching the ISO name or description of a code list:<ul>
+ *     <li>{@link #getStandardName(Class)}            for ISO name</li>
+ *     <li>{@link #getListName(ControlledVocabulary)} for ISO name</li>
+ *     <li>{@link #getDescription(Class)}             for a description</li>
+ *   </ul></li>
+ *   <li>Methods for fetching the ISO name or description of a code value:<ul>
+ *     <li>{@link #getCodeName(ControlledVocabulary)}    for ISO name,</li>
+ *     <li>{@link #getCodeTitle(ControlledVocabulary)}   for a label or title</li>
+ *     <li>{@link #getDescription(ControlledVocabulary)} for a more verbose description</li>
+ *   </ul></li>
+ *   <li>Methods for fetching an instance from a name (converse of above {@code get} methods):<ul>
+ *     <li>{@link #forCodeName(Class, String, boolean)}</li>
+ *     <li>{@link #forEnumName(Class, String)}</li>
+ *   </ul></li>
+ * </ul>
+ *
+ * <div class="section">Substituting a free text by a code list</div>
+ * The ISO standard allows to substitute some character strings in the <cite>"free text"</cite> domain
+ * by a {@link CodeList} value.
+ *
+ * <div class="note"><b>Example:</b>
+ * in the following XML fragment, the {@code <gmi:type>} value is normally a {@code <gco:CharacterString>}
+ * but has been replaced by a {@code SensorType} code below:
+ *
+ * {@preformat xml
+ *   <gmi:MI_Instrument>
+ *     <gmi:type>
+ *       <gmi:MI_SensorTypeCode
+ *           codeList="http://navigator.eumetsat.int/metadata_schema/eum/resources/Codelist/eum_gmxCodelists.xml#CI_SensorTypeCode"
+ *           codeListValue="RADIOMETER">Radiometer</gmi:MI_SensorTypeCode>
+ *     </gmi:type>
+ *   </gmi:MI_Instrument>
+ * }
+ * </div>
+ *
+ * Such substitution can be done with:
+ *
+ * <ul>
+ *   <li>{@link #getCodeTitle(ControlledVocabulary)} for getting the {@link InternationalString} instance
+ *       to store in a metadata property.</li>
+ *   <li>{@link #forCodeTitle(CharSequence)} for retrieving the {@link CodeList} previously stored as an
+ *       {@code InternationalString}.</li>
  * </ul>
  *
  * @author  Martin Desruisseaux (IRD, Geomatys)
  * @since   0.3
- * @version 0.5
+ * @version 0.7
  * @module
  */
 public final class Types extends Static {
@@ -226,10 +265,15 @@ public final class Types extends Static
      * Returns the title of the given enumeration or code list value. Title are usually much shorter than descriptions.
      * English titles are often the same than the {@linkplain #getCodeLabel(ControlledVocabulary) code labels}.
      *
+     * <p>The code or enumeration value given in argument to this method can be retrieved from the returned title
+     * with the {@link #forCodeTitle(CharSequence)} method. See <cite>Substituting a free text by a code list</cite>
+     * in this class javadoc for more information.</p>
+     *
      * @param  code The code for which to get the title, or {@code null}.
      * @return The title, or {@code null} if the given code is null.
      *
      * @see #getDescription(ControlledVocabulary)
+     * @see #forCodeTitle(CharSequence)
      */
     public static InternationalString getCodeTitle(final ControlledVocabulary code) {
         return (code != null) ? new CodeTitle(code) : null;
@@ -250,7 +294,7 @@ public final class Types extends Static
         if (code != null) {
             final String resources = getResources(code.getClass().getName());
             if (resources != null) {
-                return new Description(resources, resourceKey(code));
+                return new Description(resources, Description.resourceKey(code));
             }
         }
         return null;
@@ -358,14 +402,25 @@ public final class Types extends Static
         String fallback() {
             return CharSequences.camelCaseToSentence(key.substring(key.lastIndexOf(SEPARATOR) + 1)).toString();
         }
+
+        /**
+         * Returns the resource key for the given code list.
+         */
+        static String resourceKey(final ControlledVocabulary code) {
+            String key = getCodeName(code);
+            if (key.indexOf(SEPARATOR) < 0) {
+                key = getListName(code) + SEPARATOR + key;
+            }
+            return key;
+        }
     }
 
     /**
      * The {@link InternationalString} returned by the {@code Types.getCodeTitle(…)} method.
-     * The code below is a duplicated - in a different way - of {@code CodeListProxy(CodeList)}
+     * The code below is a duplicated - in a different way - of {@code CodeListUID(CodeList)}
      * constructor ({@link org.apache.sis.internal.jaxb.code package}). This duplication exists
-     * because {@code CodeListProxy} constructor stores more information in an opportunist way.
-     * If this method is updated, please update {@code CodeListProxy(CodeList)} accordingly.
+     * because {@code CodeListUID} constructor stores more information in an opportunist way.
+     * If this method is updated, please update {@code CodeListUID(CodeList)} accordingly.
      *
      * @author  Martin Desruisseaux (Geomatys)
      * @since   0.3
@@ -381,7 +436,7 @@ public final class Types extends Static
         /**
          * The code list for which to create a title.
          */
-        private final ControlledVocabulary code;
+        final ControlledVocabulary code;
 
         /**
          * Creates a new international string for the given code list element.
@@ -418,17 +473,6 @@ public final class Types extends Static
     }
 
     /**
-     * Returns the resource key for the given code list.
-     */
-    static String resourceKey(final ControlledVocabulary code) {
-        String key = getCodeName(code);
-        if (key.indexOf(SEPARATOR) < 0) {
-            key = getListName(code) + SEPARATOR + key;
-        }
-        return key;
-    }
-
-    /**
      * Returns all known values for the given type of code list or enumeration.
      * Note that the size of the returned array may growth between different invocations of this method,
      * since users can add their own codes to an existing list.
@@ -499,6 +543,7 @@ public final class Types extends Static
                 throw new BackingStoreException(e);
             }
             typeForNames = new HashMap<>(props);
+            JDK8.putIfAbsent(typeForNames, "MI_SensorTypeCode", "org.apache.sis.internal.metadata.SensorType");
         }
         final Object value = typeForNames.get(identifier);
         if (value == null || value instanceof Class<?>) {
@@ -587,6 +632,7 @@ public final class Types extends Static
      * @return A code matching the given name, or {@code null} if the name is null
      *         or if no matching code is found and {@code canCreate} is {@code false}.
      *
+     * @see #getCodeName(ControlledVocabulary)
      * @see CodeList#valueOf(Class, String)
      */
     public static <T extends CodeList<T>> T forCodeName(final Class<T> codeType, String name, final boolean canCreate) {
@@ -598,6 +644,27 @@ public final class Types extends Static
     }
 
     /**
+     * Returns the code list or enumeration value for the given title, or {@code null} if none.
+     * The current implementation performs the following choice:
+     *
+     * <ul>
+     *   <li>If the given title is a value returned by a previous call to {@link #getCodeTitle(ControlledVocabulary)},
+     *       returns the code or enumeration value used for creating that title.</li>
+     *   <li>Otherwise returns {@code null}.</li>
+     * </ul>
+     *
+     * @param  title The title for which to get a code or enumeration value, or {@code null}.
+     * @return The code or enumeration value associated with the given title, or {@code null}.
+     *
+     * @since 0.7
+     *
+     * @see #getCodeTitle(ControlledVocabulary)
+     */
+    public static ControlledVocabulary forCodeTitle(final CharSequence title) {
+        return (title instanceof CodeTitle) ? ((CodeTitle) title).code : null;
+    }
+
+    /**
      * Returns an international string for the values in the given properties map, or {@code null} if none.
      * This method is used when a property in a {@link java.util.Map} may have many localized variants.
      * For example the given map may contains a {@code "remarks"} property defined by values associated to

Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/iso/package-info.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/iso/package-info.java?rev=1710256&r1=1710255&r2=1710256&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/iso/package-info.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/iso/package-info.java [UTF-8] Fri Oct 23 16:04:17 2015
@@ -17,20 +17,19 @@
 
 /**
  * Implementations of GeoAPI types from the {@link org.opengis.util} package.
- * {@code InternationalString} implementations are closely related to the {@code <gmd:textGroup>}
- * XML element found in ISO specifications. All other non-static types except the {@code Factory}
- * implementations are derived from the ISO 19103 specification.
  * The main content of this package are:
  *
  * <ul>
- *   <li>Implementations of {@link org.opengis.util.InternationalString}:
+ *   <li>Implementations of {@link org.opengis.util.InternationalString}
+ *       (related to the {@code <gmd:textGroup>} XML element found in ISO specifications):
  *     <ul>
  *       <li>{@link org.apache.sis.util.iso.SimpleInternationalString}   for wrapping a single {@link java.lang.String};</li>
  *       <li>{@link org.apache.sis.util.iso.DefaultInternationalString}  for providing many localizations in a {@link java.util.Map};</li>
  *       <li>{@link org.apache.sis.util.iso.ResourceInternationalString} for providing localizations from a {@link java.util.ResourceBundle}.</li>
+ *       <li>{@link org.apache.sis.util.iso.Types#getCodeTitle Types.getCodeTitle(ControlledVocabulary)} for wrapping a {@link org.opengis.util.CodeList} value.</li>
  *     </ul>
  *   </li>
- *   <li>Implementations of {@link org.opengis.util.GenericName}:
+ *   <li>Implementations of {@link org.opengis.util.GenericName} (derived from ISO 19103):
  *     <ul>
  *       <li>{@link org.apache.sis.util.iso.DefaultLocalName}  for identifier within a {@linkplain org.apache.sis.util.iso.DefaultNameSpace name space}.</li>
  *       <li>{@link org.apache.sis.util.iso.DefaultMemberName} for identifying a member of a {@linkplain org.apache.sis.util.iso.DefaultRecord record}.</li>
@@ -38,7 +37,7 @@
  *       <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:
+ *   <li>Implementations of {@link org.opengis.util.Record} and related classes (derived from ISO 19103):
  *     <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>
@@ -109,7 +108,7 @@
  *
  * @author  Martin Desruisseaux (IRD, Geomatys)
  * @since   0.3
- * @version 0.5
+ * @version 0.7
  * @module
  */
 @XmlSchema(elementFormDefault = XmlNsForm.QUALIFIED, namespace = Namespaces.GCO, xmlns = {

Modified: sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/test/AnnotationsTestCase.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/test/AnnotationsTestCase.java?rev=1710256&r1=1710255&r2=1710256&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/test/AnnotationsTestCase.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/test/AnnotationsTestCase.java [UTF-8] Fri Oct 23 16:04:17 2015
@@ -25,6 +25,7 @@ import javax.xml.bind.annotation.XmlType
 import javax.xml.bind.annotation.XmlSchema;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlElementRef;
+import javax.xml.bind.annotation.XmlElementRefs;
 import javax.xml.bind.annotation.XmlRootElement;
 import org.opengis.util.CodeList;
 import org.opengis.util.ControlledVocabulary;
@@ -657,7 +658,8 @@ public abstract strictfp class Annotatio
                              getter.getReturnType(), getSingleton(setter.getParameterTypes()));
                 element = getter.getAnnotation(XmlElement.class);
                 assertEquals("Expected @XmlElement XOR @XmlElementRef.", (element == null),
-                             getter.isAnnotationPresent(XmlElementRef.class));
+                             getter.isAnnotationPresent(XmlElementRef.class) ||
+                             getter.isAnnotationPresent(XmlElementRefs.class));
             }
             /*
              * If the annotation is @XmlElement, ensure that XmlElement.name() is equals to

Modified: sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/util/iso/TypesTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/util/iso/TypesTest.java?rev=1710256&r1=1710255&r2=1710256&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/util/iso/TypesTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/util/iso/TypesTest.java [UTF-8] Fri Oct 23 16:04:17 2015
@@ -237,12 +237,15 @@ public final strictfp class TypesTest ex
 
     /**
      * Tests {@link Types#getCodeTitle(ControlledVocabulary)}.
+     * Also opportunistically tests {@link Types#forCodeTitle(CharSequence)}.
      */
     @Test
     public void testGetCodeTitle() {
-        assertEquals("Download",       Types.getCodeTitle(OnLineFunction.DOWNLOAD).toString(Locale.ROOT));
-        assertEquals("Download",       Types.getCodeTitle(OnLineFunction.DOWNLOAD).toString(Locale.ENGLISH));
-        assertEquals("Téléchargement", Types.getCodeTitle(OnLineFunction.DOWNLOAD).toString(Locale.FRENCH));
+        final InternationalString title = Types.getCodeTitle(OnLineFunction.DOWNLOAD);
+        assertSame("forCodeTitle", OnLineFunction.DOWNLOAD, Types.forCodeTitle(title));
+        assertEquals("Download",       title.toString(Locale.ROOT));
+        assertEquals("Download",       title.toString(Locale.ENGLISH));
+        assertEquals("Téléchargement", title.toString(Locale.FRENCH));
     }
 
     /**