sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1810211 - in /sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis: internal/jaxb/name/NameAdapter.java util/iso/DefaultLocalName.java
Date Sat, 30 Sep 2017 14:50:49 GMT
Author: desruisseaux
Date: Sat Sep 30 14:50:49 2017
New Revision: 1810211

URL: http://svn.apache.org/viewvc?rev=1810211&view=rev
Log:
Javadoc and method ordering.

Modified:
    sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/name/NameAdapter.java
    sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultLocalName.java

Modified: sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/name/NameAdapter.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/name/NameAdapter.java?rev=1810211&r1=1810210&r2=1810211&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/name/NameAdapter.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/name/NameAdapter.java
[UTF-8] Sat Sep 30 14:50:49 2017
@@ -44,7 +44,7 @@ import org.apache.sis.util.resources.Err
  * @author  Cédric Briançon (Geomatys)
  * @author  Martin Desruisseaux (Geomatys)
  * @author  Guilhem Legal (Geomatys)
- * @version 0.5
+ * @version 0.8
  * @since   0.3
  * @module
  */
@@ -79,7 +79,9 @@ abstract class NameAdapter<ValueType ext
      * Example:
      *
      * {@preformat xml
-     *   <gco:LocalName codeSpace=\"A code space\">A name in a scope</gco:LocalName>
+     *   <gml:alias>
+     *     <gco:LocalName codeSpace=\"A code space\">A name in a scope</gco:LocalName>
+     *   </gml:alias>
      * }
      *
      * @return the code for the current name, or {@code null} if none.
@@ -104,30 +106,18 @@ abstract class NameAdapter<ValueType ext
     }
 
     /**
-     * Sets the value for the {@code LocalName} or {@code ScopedName}.
-     * This method is called at unmarshalling-time by JAXB.
-     *
-     * @param  code  the new name.
-     * @throws IllegalStateException if a name is already defined.
-     */
-    public final void setValue(final NameValue code) throws IllegalStateException {
-        ensureUndefined();
-        if (code != null) {
-            name = code.getName();
-        }
-    }
-
-    /**
      * Returns the {@code TypeName} or {@code MemberName} to marshall. Returns {@code null}
if the name
      * is a {@link LocalName} or {@link ScopedName}, in order to use {@link #getValue()}
instead.
      * Example:
      *
      * {@preformat xml
-     *   <gco:TypeName>
-     *     <gco:aName>
-     *       <gco:CharacterString>An other local name</gco:CharacterString>
-     *     </gco:aName>
-     *   </gco:TypeName>
+     *   <gml:alias>
+     *     <gco:TypeName>
+     *       <gco:aName>
+     *         <gco:CharacterString>An other local name</gco:CharacterString>
+     *       </gco:aName>
+     *     </gco:TypeName>
+     *   </gml:alias>
      * }
      *
      * @return the current name, or {@code null} if none.
@@ -144,6 +134,20 @@ abstract class NameAdapter<ValueType ext
         }
     }
 
+    /**
+     * Sets the value for the {@code LocalName} or {@code ScopedName}.
+     * This method is called at unmarshalling-time by JAXB.
+     *
+     * @param  code  the new name.
+     * @throws IllegalStateException if a name is already defined.
+     */
+    public final void setValue(final NameValue code) throws IllegalStateException {
+        ensureUndefined();
+        if (code != null) {
+            name = code.getName();
+        }
+    }
+
     /**
      * Sets the value from the {@code TypeName} or {@code MemberName}.
      * This method is called at unmarshalling-time by JAXB.

Modified: sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultLocalName.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultLocalName.java?rev=1810211&r1=1810210&r2=1810211&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultLocalName.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultLocalName.java
[UTF-8] Sat Sep 30 14:50:49 2017
@@ -91,10 +91,25 @@ public class DefaultLocalName extends Ab
      * The name, either as a {@link String} or an {@link InternationalString}.
      *
      * <div class="section">Note on JAXB annotation</div>
-     * The {@link XmlElement} annotation applied here is appropriate for subclasses only
({@link DefaultTypeName}
-     * and {@link DefaultMemberName}). It is <strong>not</strong> appropriate
when (un)marshalling directly this
-     * {@code DefaultLocalName} class. In this later case, we will rather rely on the {@link
String} conversion
-     * performed by {@link org.apache.sis.internal.jaxb.name.GO_GenericName}.
+     * The {@link XmlElement} annotation applied here is appropriate for {@code TypeName}
and {@code MemberName}
+     * subtypes only. It is <strong>not</strong> appropriate when (un)marshalling
directly a {@code LocalName}.
+     * The distinction between the two cases is done by {@link org.apache.sis.internal.jaxb.name.GO_LocalName},
+     * which replace the {@code LocalName} instance by an internal {@code NameValue} object
(so the XML element
+     * declared here is never marshalled). Example:
+     *
+     * {@preformat xml
+     *   <gco:LocalName codeSpace=\"A code space\">A name in a scope</gco:LocalName>
+     * }
+     *
+     * versus
+     *
+     * {@preformat xml
+     *   <gco:TypeName>
+     *     <gco:aName>
+     *       <gco:CharacterString>An other local name</gco:CharacterString>
+     *     </gco:aName>
+     *   </gco:TypeName>
+     * }
      */
     @XmlJavaTypeAdapter(CharSequenceAdapter.class)
     @XmlElement(name = "aName", namespace = Namespaces.GCO)



Mime
View raw message