Author: desruisseaux
Date: Thu Mar 6 12:06:26 2014
New Revision: 1574851
URL: http://svn.apache.org/r1574851
Log:
Added an example in Builder javadoc, minor other javadoc fixes and tests.
Modified:
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterDescriptor.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/Builder.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/NamedIdentifier.java
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/BuilderTest.java
Modified:
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterDescriptor.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterDescriptor.java?rev=1574851&r1=1574850&r2=1574851&view=diff
==============================================================================
---
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterDescriptor.java
[UTF-8] (original)
+++
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterDescriptor.java
[UTF-8] Thu Mar 6 12:06:26 2014
@@ -123,7 +123,7 @@ public class DefaultParameterDescriptor<
private final T defaultValue;
/**
- * Constructs a descriptor from a set of properties. The properties map is
given unchanged to the
+ * Constructs a descriptor from the given properties. The properties map
is given unchanged to the
* {@linkplain AbstractIdentifiedObject#AbstractIdentifiedObject(Map)
super-class constructor}.
* The following table is a reminder of main (not all) properties:
*
Modified:
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/Builder.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/Builder.java?rev=1574851&r1=1574850&r2=1574851&view=diff
==============================================================================
---
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/Builder.java
[UTF-8] (original)
+++
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/Builder.java
[UTF-8] Thu Mar 6 12:06:26 2014
@@ -49,21 +49,21 @@ import java.util.Objects;
*
* <p>This base class provides method for defining the following {@link
IdentifiedObject} properties:</p>
* <ul>
- * <li><p><b>{@link AbstractIdentifiedObject#getName() Name}:</b><br>
+ * <li><b>{@link AbstractIdentifiedObject#getName() Name}:</b>
* Each {@code IdentifiedObject} shall have a name, which can be specified
by a call to any of the
- * {@code name(…)} methods defined in this class.</p></li>
+ * {@code name(…)} methods defined in this class.</li>
*
- * <li><p><b>{@link AbstractIdentifiedObject#getAlias() Aliases}:</b><br>
+ * <li><b>{@link AbstractIdentifiedObject#getAlias() Aliases}:</b>
* Identified objects can optionally have an arbitrary amount of aliases,
which are also specified
- * by the {@code name(…)} methods — each call after the first one adds an
alias.</p></li>
+ * by the {@code name(…)} methods — each call after the first one adds an
alias.</li>
*
- * <li><p><b>{@link AbstractIdentifiedObject#getIdentifiers()
Identifiers}:</b><br>
+ * <li><b>{@link AbstractIdentifiedObject#getIdentifiers() Identifiers}:</b>
* Identified objects can also have an arbitrary amount of identifiers,
which are specified by the
* {@code identifier(…)} methods. Like names, more than one identifier can
be added by invoking
- * the method many time.</p></li>
+ * the method many time.</li>
*
- * <li><p><b>{@link AbstractIdentifiedObject#getRemarks() Remarks}:</b><br>
- * Identified objects can have at most one remark, which is specified by
the {@code remarks(…)} method.</p></li>
+ * <li><b>{@link AbstractIdentifiedObject#getRemarks() Remarks}:</b>
+ * Identified objects can have at most one remark, which is specified by
the {@code remarks(…)} method.</li>
* </ul>
*
* {@section Builder property lifetimes}
@@ -81,8 +81,44 @@ import java.util.Objects;
* </ul>
*
* {@section Usage examples}
- * See {@link org.apache.sis.parameter.ParameterBuilder} class javadoc for an
example with the
- * <cite>Mercator</cite> projection.
+ * The "<cite>Mercator (variant A)</cite>" projection (EPSG:9804) is also
known as "<cite>Mercator (1SP)</cite>".
+ * OGC and GeoTIFF use slightly different names, and GeoTIFF has its own code
(7).
+ * Those information can be specified as below:
+ *
+ * {@preformat java
+ * Builder builder = new Builder();
+ * builder.codespace (Citations.OGP, "EPSG")
+ * .name ("Mercator (variant A)") // Defined in EPSG
namespace.
+ * .name ("Mercator (1SP)") // Defined in EPSG
namespace.
+ * .identifier("9804") // Defined in EPSG
namespace.
+ * .name (Citations.OGC, "Mercator_1SP")
+ * .name (Citations.GEOTIFF, "CT_Mercator")
+ * .identifier(Citations.GEOTIFF, "7")
+ * .remarks("The “Mercator (1SP)” method name was used prior to
October 2010.");
+ * // At this point, the createXXX(…) method to invoke depends on the
Builder subclass.
+ * }
+ *
+ * The two first names, which use the default namespace specified by the call
to {@code codespace(…)},
+ * will have the {@code "EPSG"} {@linkplain NamedIdentifier#scope() scope}.
Since scopes are not shown
+ * in {@linkplain NamedIdentifier#toString() string representation of names},
the string representation
+ * of the two first names will omit the {@code "EPSG:"} prefix. However the
string representation of the
+ * two last names will be {@code "OGC:Mercator_1SP"} and {@code
"GeoTIFF:CT_Mercator"} respectively.
+ *
+ * <p>The {@code IdentificationObject} created by this example will have the
following properties:</p>
+ * <ul>
+ * <li>{@link AbstractIdentifiedObject#getName() Name}:
+ * {@code "Mercator (variant A)"} as a local name in {@code "EPSG"}
scope.</li>
+ * <li>{@link AbstractIdentifiedObject#getAlias() Aliases}:
+ * {@code "Mercator (1SP)"} as a local name in {@code "EPSG"} scope,
+ * {@code "OGC:Mercator_1SP"} and {@code "GeoTIFF:CT_Mercator"} as
scoped names.</li>
+ * <li>{@link AbstractIdentifiedObject#getIdentifiers() Identifiers}:
+ * {@code "EPSG:9804"} and {@code "GeoTIFF:7"}.</li>
+ * <li>{@link AbstractIdentifiedObject#getRemarks() Remarks}:
+ * {@code "The “Mercator (1SP)” method name was used prior to October
2010."}</li>
+ * </ul>
+ *
+ * See {@link org.apache.sis.parameter.ParameterBuilder} class javadoc for
more examples with the
+ * <cite>Mercator</cite> projection parameters.
*
* {@section Note for subclass implementors}
* <ul>
Modified:
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/NamedIdentifier.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/NamedIdentifier.java?rev=1574851&r1=1574850&r2=1574851&view=diff
==============================================================================
---
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/NamedIdentifier.java
[UTF-8] (original)
+++
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/NamedIdentifier.java
[UTF-8] Thu Mar 6 12:06:26 2014
@@ -400,7 +400,7 @@ public class NamedIdentifier extends Imm
/**
* Returns a string representation of this generic name. This string
representation
* is local-independent. It contains all elements listed by {@link
#getParsedNames()}
- * separated by an arbitrary character (usually {@code :} or {@code /}).
+ * separated by a namespace-dependent character (usually {@code :} or
{@code /}).
*
* @return A local-independent string representation of this generic name.
*
Modified:
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/BuilderTest.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/BuilderTest.java?rev=1574851&r1=1574850&r2=1574851&view=diff
==============================================================================
---
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/BuilderTest.java
[UTF-8] (original)
+++
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/BuilderTest.java
[UTF-8] Thu Mar 6 12:06:26 2014
@@ -110,10 +110,10 @@ public final strictfp class BuilderTest
// The test.
final BuilderMock builder = new BuilderMock();
- builder.name("Mercator (variant A)"); // EPSG version 7.6 and later.
- builder.name("Mercator (1SP)"); // EPSG before version 7.6.
- builder.name("Mercator_1SP"); // OGC
- builder.name("CT_Mercator"); // GeoTIFF
+ assertSame(builder, builder.name("Mercator (variant A)")); // EPSG
version 7.6 and later.
+ assertSame(builder, builder.name("Mercator (1SP)")); // EPSG
before version 7.6.
+ assertSame(builder, builder.name("Mercator_1SP")); // OGC
+ assertSame(builder, builder.name("CT_Mercator")); // GeoTIFF
builder.onCreate(false);
assertEquals(name, builder.properties.get(NAME_KEY));
assertArrayEquals(new GenericName[] {alias1, alias2, alias3},
@@ -139,11 +139,11 @@ public final strictfp class BuilderTest
// The test.
final BuilderMock builder = new BuilderMock();
- builder.codespace(OGP, "EPSG");
- builder.name( "Mercator (variant A)");
- builder.name( "Mercator (1SP)");
- builder.name(OGC, "Mercator_1SP");
- builder.name(GEOTIFF, "CT_Mercator");
+ assertSame(builder, builder.codespace(OGP, "EPSG"));
+ assertSame(builder, builder.name( "Mercator (variant A)"));
+ assertSame(builder, builder.name( "Mercator (1SP)"));
+ assertSame(builder, builder.name(OGC, "Mercator_1SP"));
+ assertSame(builder, builder.name(GEOTIFF, "CT_Mercator"));
builder.onCreate(false);
assertEquals(name, builder.properties.get(NAME_KEY));
assertArrayEquals(new GenericName[] {alias1, alias2, alias3},
@@ -171,9 +171,9 @@ public final strictfp class BuilderTest
// The test.
final BuilderMock builder = new BuilderMock();
- builder.codespace (OGP, "EPSG");
- builder.identifier( "9804");
- builder.identifier(GEOTIFF, "7");
+ assertSame(builder, builder.codespace (OGP, "EPSG"));
+ assertSame(builder, builder.identifier( "9804"));
+ assertSame(builder, builder.identifier(GEOTIFF, "7"));
builder.onCreate(false);
assertArrayEquals(new ReferenceIdentifier[] {id1, id2},
(ReferenceIdentifier[])
builder.properties.get(IDENTIFIERS_KEY));