sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1757016 - in /sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/iso: DefaultTypeName.java TypeNames.java
Date Sat, 20 Aug 2016 18:12:49 GMT
Author: desruisseaux
Date: Sat Aug 20 18:12:48 2016
New Revision: 1757016

URL: http://svn.apache.org/viewvc?rev=1757016&view=rev
Log:
Add java.math.BigDecimal in the list of types for which we provide a name in the GCO namespace.
Update javadoc with both the addition of BigDecimal case and documenting the URL recommended
by WPS standard.
Opportunist javadoc reformatting.

Modified:
    sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultTypeName.java
    sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/iso/TypeNames.java

Modified: sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultTypeName.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultTypeName.java?rev=1757016&r1=1757015&r2=1757016&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultTypeName.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultTypeName.java
[UTF-8] Sat Aug 20 18:12:48 2016
@@ -38,22 +38,77 @@ import org.apache.sis.util.UnknownNameEx
  * uses that identifier prefixed by the {@code "OGC"} namespace.
  * Note that this is <strong>not</strong> a standard practice.
  * A more standard practice would be to use the <cite>definition identifiers in OGC
namespace</cite>
- * (last column in the table below), but the set of data type identifiers defined by OGC
is currently
+ * (third column in the table below), but the set of data type identifiers defined by OGC
is currently
  * small and is sometime not an exact match.
  *
  * <table class="sis">
  *   <caption>Mapping from Java classes to type names (non-exhaustive list)</caption>
- *   <tr><th>Java class</th>                                   <th>Type
name (unofficial)</th>      <th>Definition identifier in OGC namespace</th></tr>
- *   <tr><td>{@link org.opengis.util.InternationalString}</td> <td>{@code
OGC:FreeText}</td>        <td></td></tr>
- *   <tr><td>{@link java.lang.String}</td>                     <td>{@code
OGC:CharacterString}</td> <td>urn:ogc:def:dataType:OGC::string</td></tr>
- *   <tr><td>{@link java.net.URI}</td>                         <td>{@code
OGC:URI}</td>             <td>urn:ogc:def:dataType:OGC::anyURI</td></tr>
- *   <tr><td>{@link java.lang.Boolean}</td>                    <td>{@code
OGC:Boolean}</td>         <td>urn:ogc:def:dataType:OGC::boolean</td></tr>
- *   <tr><td>{@link java.lang.Integer}</td>                    <td>{@code
OGC:Integer}</td>         <td>urn:ogc:def:dataType:OGC::nonNegativeInteger</td></tr>
- *   <tr><td>{@link java.lang.Double}</td>                     <td>{@code
OGC:Real}</td>            <td></td></tr>
- *   <tr><td>{@link java.util.Date}</td>                       <td>{@code
OGC:DateTime}</td>        <td></td></tr>
- *   <tr><td>{@link java.util.Locale}</td>                     <td>{@code
OGC:PT_Locale}</td>       <td></td></tr>
- *   <tr><td>{@link org.opengis.metadata.Metadata}</td>        <td>{@code
OGC:MD_Metadata}</td>     <td></td></tr>
- *   <tr><td>Unknown Java class</td>                           <td>{@code
class:}&lt;the class name&gt;</td><td></td></tr>
+ *   <tr>
+ *     <th>Java class</th>
+ *     <th>Type name (unofficial)</th>
+ *     <th>Definition identifier in OGC namespace</th>
+ *     <th>Recommended URL in Web Processing Services</th>
+ *   </tr><tr>
+ *     <td>{@link org.opengis.util.InternationalString}</td>
+ *     <td>{@code OGC:FreeText}</td>
+ *     <td></td>
+ *     <td></td>
+ *   </tr><tr>
+ *     <td>{@link java.lang.String}</td>
+ *     <td>{@code OGC:CharacterString}</td>
+ *     <td>{@code urn:ogc:def:dataType:OGC::string}</td>
+ *     <td>{@code http://www.w3.org/2001/XMLSchema#string}</td>
+ *   </tr><tr>
+ *     <td>{@link java.net.URI}</td>
+ *     <td>{@code OGC:URI}</td>
+ *     <td>{@code urn:ogc:def:dataType:OGC::anyURI}</td>
+ *     <td></td>
+ *   </tr><tr>
+ *     <td>{@link java.lang.Boolean}</td>
+ *     <td>{@code OGC:Boolean}</td>
+ *     <td>{@code urn:ogc:def:dataType:OGC::boolean}</td>
+ *     <td>{@code http://www.w3.org/2001/XMLSchema#boolean}</td>
+ *   </tr><tr>
+ *     <td>{@link java.lang.Integer}</td>
+ *     <td>{@code OGC:Integer}</td>
+ *     <td>{@code urn:ogc:def:dataType:OGC::nonNegativeInteger}</td>
+ *     <td>{@code http://www.w3.org/2001/XMLSchema#integer}</td>
+ *   </tr><tr>
+ *     <td>{@link java.math.BigDecimal}</td>
+ *     <td>{@code OGC:Decimal}</td>
+ *     <td></td>
+ *     <td>{@code http://www.w3.org/2001/XMLSchema#decimal}</td>
+ *   </tr><tr>
+ *     <td>{@link java.lang.Double}</td>
+ *     <td>{@code OGC:Real}</td>
+ *     <td></td>
+ *     <td>{@code http://www.w3.org/2001/XMLSchema#double}</td>
+ *   </tr><tr>
+ *     <td>{@link java.lang.Float}</td>
+ *     <td>{@code OGC:Real}</td>
+ *     <td></td>
+ *     <td>{@code http://www.w3.org/2001/XMLSchema#float}</td>
+ *   </tr><tr>
+ *     <td>{@link java.util.Date}</td>
+ *     <td>{@code OGC:DateTime}</td>
+ *     <td></td>
+ *     <td></td>
+ *   </tr><tr>
+ *     <td>{@link java.util.Locale}</td>
+ *     <td>{@code OGC:PT_Locale}</td>
+ *     <td></td>
+ *     <td></td>
+ *   </tr><tr>
+ *     <td>{@link org.opengis.metadata.Metadata}</td>
+ *     <td>{@code OGC:MD_Metadata}</td>
+ *     <td></td>
+ *     <td></td>
+ *   </tr><tr>
+ *     <td>Unknown Java class</td>
+ *     <td>{@code class:}&lt;the class name&gt;</td>
+ *     <td></td>
+ *     <td></td>
+ *   </tr>
  * </table>
  *
  * The mapping defined by Apache SIS may change in any future version depending on standardization
progress.
@@ -102,8 +157,8 @@ public class DefaultTypeName extends Def
      * Constructs a type name from the given character sequence. The argument are given unchanged
to the
      * {@linkplain DefaultLocalName#DefaultLocalName(NameSpace,CharSequence) super-class
constructor}.
      *
-     * @param scope The scope of this name, or {@code null} for a global scope.
-     * @param name  The local name (never {@code null}).
+     * @param scope  the scope of this name, or {@code null} for a global scope.
+     * @param name   the local name (never {@code null}).
      *
      * @see DefaultNameFactory#createTypeName(NameSpace, CharSequence)
      */
@@ -123,8 +178,8 @@ public class DefaultTypeName extends Def
      *       with the same values than the given name.</li>
      * </ul>
      *
-     * @param  object The object to get as a SIS implementation, or {@code null} if none.
-     * @return A SIS implementation containing the values of the given object (may be the
+     * @param  object  the object to get as a SIS implementation, or {@code null} if none.
+     * @return a SIS implementation containing the values of the given object (may be the
      *         given object itself), or {@code null} if the argument was null.
      *
      * @since 0.5
@@ -179,7 +234,7 @@ public class DefaultTypeName extends Def
      *       namespaces.</li>
      * </ul>
      *
-     * @return The Java class associated to this {@code TypeName},
+     * @return the Java class associated to this {@code TypeName},
      *         or {@code null} if there is no mapping from this name to a Java class.
      * @throws UnknownNameException if a mapping from this name to a Java class was expected
to exist
      *         (typically because of the {@linkplain #scope() scope}) but the operation failed.

Modified: sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/iso/TypeNames.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/iso/TypeNames.java?rev=1757016&r1=1757015&r2=1757016&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/iso/TypeNames.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/iso/TypeNames.java
[UTF-8] Sat Aug 20 18:12:48 2016
@@ -22,6 +22,7 @@ import java.util.Map;
 import java.util.LinkedHashMap;
 import java.util.Iterator;
 import java.net.URI;
+import java.math.BigDecimal;
 import org.opengis.util.GenericName;
 import org.opengis.util.TypeName;
 import org.opengis.util.NameSpace;
@@ -37,7 +38,7 @@ import org.apache.sis.util.Numbers;
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.5
- * @version 0.5
+ * @version 0.8
  * @module
  */
 final class TypeNames {
@@ -57,7 +58,8 @@ final class TypeNames {
         m.put("URI",       URI.class);
         m.put("DateTime",  Date.class);
         m.put("PT_Locale", Locale.class);
-        m.put("Boolean",   Boolean.class);  // Used as a sentinel value for stopping iteration.
+        m.put("Decimal",   BigDecimal.class);
+        m.put("Boolean",   Boolean.class);              // Used as a sentinel value for stopping
iteration.
 
         // Entries below this point are handled in a special way.
         m.put("FreeText",        InternationalString.class);
@@ -88,9 +90,9 @@ final class TypeNames {
     /**
      * Infers the type name from the given class.
      *
-     * @param  factory    The same factory than the one given to the constructor.
-     * @param  valueClass The value class for which to get a type name.
-     * @return A type name for the given class (never {@code null}).
+     * @param  factory     the same factory than the one given to the constructor.
+     * @param  valueClass  the value class for which to get a type name.
+     * @return a type name for the given class (never {@code null}).
      */
     final TypeName toTypeName(final NameFactory factory, final Class<?> valueClass)
{
         String name;
@@ -148,10 +150,10 @@ final class TypeNames {
      *   <li>Otherwise the class for the given name.</li>
      * </ul>
      *
-     * @param  namespace The namespace, case-insensitive. Can be any value, but this method
recognizes
+     * @param  namespace  the namespace, case-insensitive. Can be any value, but this method
recognizes
      *         only {@code "OGC"}, {@code "class"} and {@code null}. Other namespaces will
be ignored.
-     * @param  name The name, case-sensitive.
-     * @return The class, or {@code Void.TYPE} if the given namespace is not recognized,
+     * @param  name  the name, case-sensitive.
+     * @return the class, or {@code Void.TYPE} if the given namespace is not recognized,
      *         or {@code null} if the namespace is recognized but not the name.
      * @throws ClassNotFoundException if {@code namespace} is {@code "class"} but {@code
name} is not
      *         the name of a reachable class.
@@ -163,13 +165,13 @@ final class TypeNames {
             if (c == null) {
                 c = Types.forStandardName(name);
                 if (c == null && namespace == null) {
-                    c = Void.TYPE; // Unknown name not considered an error if not in "OGC"
namespace.
+                    c = Void.TYPE;          // Unknown name not considered an error if not
in "OGC" namespace.
                 }
             }
         } else if (namespace.equalsIgnoreCase("class")) {
             c = Class.forName(name);
         } else {
-            c = Void.TYPE; // Not an "OGC" or "class" namespace.
+            c = Void.TYPE;                  // Not an "OGC" or "class" namespace.
         }
         return c;
     }



Mime
View raw message