Author: desruisseaux
Date: Thu Mar 6 16:46:50 2014
New Revision: 1574957
URL: http://svn.apache.org/r1574957
Log:
Change in method name policy in Builder class: explict "add" and "set" verb
for differentiating the methods that overwrite the previoius values from the
properties that accepts multi-values.
Modified:
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/parameter/ParameterBuilder.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/Builder.java
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/parameter/ParameterBuilderTest.java
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/BuilderTest.java
sis/branches/JDK7/src/main/javadoc/stylesheet.css
Modified:
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/parameter/ParameterBuilder.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/parameter/ParameterBuilder.java?rev=1574957&r1=1574956&r2=1574957&view=diff
==============================================================================
---
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/parameter/ParameterBuilder.java
[UTF-8] (original)
+++
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/parameter/ParameterBuilder.java
[UTF-8] Thu Mar 6 16:46:50 2014
@@ -35,15 +35,15 @@ import static org.apache.sis.util.Argume
* provided by the implementor.
*
* {@section Identification properties}
- * Each parameter must have a name, which can be specified by any of the
{@code name(…)} methods.
+ * Each parameter must have a name, which can be specified by any of the
{@code addName(…)} methods.
* Parameters 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.
+ * {@code addName(…)} methods — each call after the first one adds an alias.
*
* <p>Parameters 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
+ * {@code addIdentifier(…)} methods. Like names, more than one identifier can
be added by invoking
* the method many time.</p>
*
- * <p>Parameters can have at most one remark, which is specified by the {@code
remarks(…)} method.</p>
+ * <p>Parameters can have at most one remark, which is specified by the {@code
setRemarks(…)} method.</p>
*
* <p>All the above-cited properties are cleared after a call to any {@code
createXXX(…)} method,
* since those properties are specific to the each parameter. Other properties
like codespace,
@@ -58,23 +58,24 @@ import static org.apache.sis.util.Argume
*
* {@preformat java
* ParameterBuilder builder = new ParameterBuilder();
- * builder.codespace(Citations.OGP, "EPSG").mandatory();
+ * builder.setCodeSpace(Citations.OGP, "EPSG").setRequired(true);
* ParameterDescriptor<Double>[] parameters = {
- * builder.name("Latitude of natural origin") .createBounded( -80,
+84, 0, NonSI.DEGREE_ANGLE),
- * builder.name("Longitude of natural origin") .createBounded(-180,
+180, 0, NonSI.DEGREE_ANGLE),
- * builder.name("Scale factor at natural
origin").createStrictlyPositive(1, Unit.ONE),
- * builder.name("False easting") .create(0, SI.METRE),
- * builder.name("False northing") .create(0, SI.METRE)
+ * builder.addName("Latitude of natural origin") .createBounded( -80,
+84, 0, NonSI.DEGREE_ANGLE),
+ * builder.addName("Longitude of natural origin") .createBounded(-180,
+180, 0, NonSI.DEGREE_ANGLE),
+ * builder.addName("Scale factor at natural
origin").createStrictlyPositive(1, Unit.ONE),
+ * builder.addName("False easting") .create(0, SI.METRE),
+ * builder.addName("False northing") .create(0, SI.METRE)
* };
* }
*
- * Note that different softwares or standards may use different names for the
same parameters.
- * Aliases may be defined to any parameters like below:
+ * Parameters often have more than one name, because different softwares or
standards use different conventions.
+ * In the above example, the line creating the <cite>Longitude of natural
origin</cite> parameter could be replaced
+ * by the following code in order to declare its aliases:
*
* {@preformat java
- * builder.name("Longitude of natural origin") // Primary name in
builder default namespace.
- * .name(Citations.OGC, "central_meridian") // First alias in
"OGC" namespace.
- * .name(Citations.GEOTIFF, "NatOriginLong") // Second alias in
"GeoTIFF" namespace.
+ * builder.addName("Longitude of natural origin") // Primary name in
builder default namespace.
+ * .addName(Citations.OGC, "central_meridian") // First alias in
"OGC" namespace.
+ * .addName(Citations.GEOTIFF, "NatOriginLong") // Second alias in
"GeoTIFF" namespace.
* .createBounded(-80, +84, 0, NonSI.DEGREE_ANGLE);
* }
*
@@ -87,8 +88,7 @@ public class ParameterBuilder extends Bu
/**
* {@code true} if the parameter is mandatory, or {@code false} if
optional.
*
- * @see #mandatory()
- * @see #optional()
+ * @see #setRequired(boolean)
*/
private boolean required;
@@ -99,24 +99,21 @@ public class ParameterBuilder extends Bu
}
/**
- * Sets the parameter as mandatory.
- * The minimum number of times that values are required will be 1.
+ * Sets whether the parameter is mandatory or optional.
+ * This property determines the {@linkplain
DefaultParameterDescriptor#getMinimumOccurs() minimum number
+ * of times} that values are required, which will be 0 for an optional
parameter and 1 for a mandatory one.
*
- * @return {@code this}, for method call chaining.
- */
- public ParameterBuilder mandatory() {
- this.required = true;
- return this;
- }
-
- /**
- * Sets the parameter as optional.
- * The minimum number of times that values are required will be 0.
+ * <p><b>Default value:</b>
+ * If this method is never invoked, then the default value is {@code
false}.</p>
+ *
+ * <p><b>Lifetime:</b>
+ * this property is kept unchanged until this {@code setRequired(…)}
method is invoked again.</p>
*
+ * @param required {@code true} for a mandatory parameter, or {@code
false} for an optional one.
* @return {@code this}, for method call chaining.
*/
- public ParameterBuilder optional() {
- this.required = false;
+ public ParameterBuilder setRequired(final boolean required) {
+ this.required = required;
return this;
}
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=1574957&r1=1574956&r2=1574957&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 16:46:50 2014
@@ -42,29 +42,30 @@ import java.util.Objects;
/**
* Base class of builders for various kind of {@link IdentifiedObject}. {@code
Builder}s aim to make object creation
* easier — they do not add any new functionality compared to {@link
org.opengis.referencing.ObjectFactory}.
- * Builder methods like {@link #name(CharSequence)} and {@link
#identifier(String)} provide convenient ways
+ * Builder methods like {@link #addName(CharSequence)} and {@link
#addIdentifier(String)} provide convenient ways
* to fill the {@link #properties} map, which will be given to the {@code
ObjectFactory} methods at
* {@code IdentifiedObject} creation time. Creations happen when any {@code
createXXX(…)} method defined in
* the builder subclasses is invoked.
*
* <p>This base class provides method for defining the following {@link
IdentifiedObject} properties:</p>
- * <ul>
- * <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.</li>
- *
- * <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.</li>
- *
- * <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.</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>
+ * <blockquote><table class="compact">
+ * <tr><td>{@link AbstractIdentifiedObject#getName() Name}:</td>
+ * <td>Each {@code IdentifiedObject} shall have a name, which can be
specified by a call to any of the
+ * {@code addName(…)} methods defined in this class.</td></tr>
+ *
+ * <tr><td>{@link AbstractIdentifiedObject#getAlias() Aliases}:</td>
+ * <td>Identified objects can optionally have an arbitrary amount of
aliases, which are also specified
+ * by the {@code addName(…)} methods — each call after the first one adds
an alias.</td></tr>
+ *
+ * <tr><td>{@link AbstractIdentifiedObject#getIdentifiers() Identifiers}:</td>
+ * <td>Identified objects can also have an arbitrary amount of
identifiers, which are specified by the
+ * {@code addIdentifier(…)} methods. Like names, more than one identifier
can be added by invoking
+ * the method many time.</td></tr>
+ *
+ * <tr><td>{@link AbstractIdentifiedObject#getRemarks() Remarks}:</td>
+ * <td>Identified objects can have at most one remark, which is specified
by the {@code setRemarks(…)}
+ * method.</td></tr>
+ * </table></blockquote>
*
* {@section Builder property lifetimes}
* The same builder can be used for creating many objects, since constructing
a Coordinate Reference System (CRS)
@@ -87,35 +88,35 @@ import java.util.Objects;
*
* {@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.");
+ * builder.setCodespace (Citations.OGP, "EPSG")
+ * .addName ("Mercator (variant A)") // Defined in
EPSG namespace.
+ * .addName ("Mercator (1SP)") // Defined in
EPSG namespace.
+ * .addIdentifier("9804") // Defined in
EPSG namespace.
+ * .addName (Citations.OGC, "Mercator_1SP")
+ * .addName (Citations.GEOTIFF, "CT_Mercator")
+ * .addIdentifier(Citations.GEOTIFF, "7")
+ * .setRemarks("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(…)},
+ * The two first names, which use the default namespace specified by the call
to {@code setCodeSpace(…)},
* 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>
+ * <blockquote><table class="compact">
+ * <tr><td>{@link AbstractIdentifiedObject#getName() Name}:</td>
+ * <td>{@code "Mercator (variant A)"} as a local name in {@code "EPSG"}
scope.</td></tr>
+ * <tr><td>{@link AbstractIdentifiedObject#getAlias() Aliases}:</td>
+ * <td>{@code "Mercator (1SP)"} as a local name in {@code "EPSG"} scope,
+ * {@code "OGC:Mercator_1SP"} and {@code "GeoTIFF:CT_Mercator"} as
scoped names.</td></tr>
+ * <tr><td>{@link AbstractIdentifiedObject#getIdentifiers() Identifiers}:</td>
+ * <td>{@code "EPSG:9804"} and {@code "GeoTIFF:7"}.</td></tr>
+ * <tr><td>{@link AbstractIdentifiedObject#getRemarks() Remarks}:</td>
+ * <td>{@code "The “Mercator (1SP)” method name was used prior to October
2010."}</td></tr>
+ * </table></blockquote>
*
* See {@link org.apache.sis.parameter.ParameterBuilder} class javadoc for
more examples with the
* <cite>Mercator</cite> projection parameters.
@@ -263,19 +264,19 @@ public abstract class Builder<B extends
*
* <p><b>Condition:</b>
* this method can not be invoked after one or more names or identifiers
have been added (by calls to the
- * {@code name(…)} or {@code identifier(…)} methods) for the next object
to create. This method can be
+ * {@code addName(…)} or {@code addIdentifier(…)} methods) for the next
object to create. This method can be
* invoked again after the name, aliases and identifiers have been cleared
by a call to {@code createXXX(…)}.</p>
*
* <p><b>Lifetime:</b>
- * this property is kept unchanged until this {@code codespace(…)} method
is invoked again.</p>
+ * this property is kept unchanged until this {@code setCodeSpace(…)}
method is invoked again.</p>
*
* @param authority Bibliographic reference to the authority defining the
codes, or {@code null} if none.
* @param codespace The {@code IdentifiedObject} codespace, or {@code
null} for inferring it from the authority.
* @return {@code this}, for method call chaining.
- * @throws IllegalStateException if {@code name(…)} or {@code
identifier(…)} has been invoked at least
+ * @throws IllegalStateException if {@code addName(…)} or {@code
addIdentifier(…)} has been invoked at least
* once since builder construction or since the last call to a
{@code createXXX(…)} method.
*/
- public B codespace(final Citation authority, final String codespace) {
+ public B setCodeSpace(final Citation authority, final String codespace) {
if (!setProperty(ReferenceIdentifier.CODESPACE_KEY, codespace)) {
namespace = null;
}
@@ -289,26 +290,26 @@ public abstract class Builder<B extends
*
* <p><b>Condition:</b>
* this method can not be invoked after one or more names or identifiers
have been added (by calls to the
- * {@code name(…)} or {@code identifier(…)} methods) for the next object
to create. This method can be
+ * {@code addName(…)} or {@code addIdentifier(…)} methods) for the next
object to create. This method can be
* invoked again after the name, aliases and identifiers have been cleared
by a call to {@code createXXX(…)}.</p>
*
* <p><b>Lifetime:</b>
- * this property is kept unchanged until this {@code version(…)} method is
invoked again.</p>
+ * this property is kept unchanged until this {@code setVersion(…)} method
is invoked again.</p>
*
* @param version The version of code definitions, or {@code null} if
none.
* @return {@code this}, for method call chaining.
- * @throws IllegalStateException if {@code name(…)} or {@code
identifier(…)} has been invoked at least
+ * @throws IllegalStateException if {@code addName(…)} or {@code
addIdentifier(…)} has been invoked at least
* once since builder construction or since the last call to a
{@code createXXX(…)} method.
*/
- public B version(final String version) {
+ public B setVersion(final String version) {
setProperty(ReferenceIdentifier.VERSION_KEY, version);
return self();
}
/**
* Adds an {@code IdentifiedObject} name given by a {@code String} or
{@code InternationalString}.
- * The given string will be combined with the authority, {@linkplain
#codespace(Citation, String) code space}
- * and {@linkplain #version(String) version} information for creating the
{@link ReferenceIdentifier} or
+ * The given string will be combined with the authority, {@link
#setCodeSpace(Citation, String) code space}
+ * and {@link #setVersion(String) version} information for creating the
{@link ReferenceIdentifier} or
* {@link GenericName} object.
*
* {@section Name and aliases}
@@ -322,7 +323,7 @@ public abstract class Builder<B extends
* @param name The {@code IdentifiedObject} name.
* @return {@code this}, for method call chaining.
*/
- public B name(final CharSequence name) {
+ public B addName(final CharSequence name) {
ensureNonNull("name", name);
final Object old = properties.put(IdentifiedObject.NAME_KEY,
name.toString());
if (old != null) {
@@ -341,10 +342,10 @@ public abstract class Builder<B extends
* by OGC and GeoTIFF. Those alternative names can be defined as below:
*
* {@preformat java
- * builder.codespace(Citations.OGP, "EPSG") // Sets the
default namespace to "EPSG".
- * .name("Longitude of natural origin") // Primary name in
builder default namespace.
- * .name(Citations.OGC, "central_meridian") // First alias in
"OGC" namespace.
- * .name(Citations.GEOTIFF, "NatOriginLong"); // Second alias in
"GeoTIFF" namespace.
+ * builder.setCodespace(Citations.OGP, "EPSG") // Sets the
default namespace to "EPSG".
+ * .addName("Longitude of natural origin") // Primary name
in builder default namespace.
+ * .addName(Citations.OGC, "central_meridian") // First alias
in "OGC" namespace.
+ * .addName(Citations.GEOTIFF, "NatOriginLong"); // Second alias
in "GeoTIFF" namespace.
* }
*
* In this example, {@code "central_meridian"} will be the
@@ -358,9 +359,9 @@ public abstract class Builder<B extends
* @param name The {@code IdentifiedObject} alias as a name in the
namespace of the given authority.
* @return {@code this}, for method call chaining.
*
- * @see #identifier(Citation, String)
+ * @see #addIdentifier(Citation, String)
*/
- public B name(final Citation authority, final CharSequence name) {
+ public B addName(final Citation authority, final CharSequence name) {
ensureNonNull("name", name);
final NamedIdentifier identifier;
if (name instanceof InternationalString) {
@@ -378,8 +379,8 @@ public abstract class Builder<B extends
/**
* Adds an {@code IdentifiedObject} name fully specified by the given
identifier.
- * This method ignores the authority, {@linkplain #codespace(Citation,
String) code space} or
- * {@linkplain #version(String) version} specified to this builder (if
any), since the given
+ * This method ignores the authority, {@link #setCodeSpace(Citation,
String) code space} or
+ * {@link #setVersion(String) version} specified to this builder (if any),
since the given
* identifier already contains those information.
*
* {@section Name and aliases}
@@ -393,7 +394,7 @@ public abstract class Builder<B extends
* @param name The {@code IdentifiedObject} name as an identifier.
* @return {@code this}, for method call chaining.
*/
- public B name(final ReferenceIdentifier name) {
+ public B addName(final ReferenceIdentifier name) {
ensureNonNull("name", name);
final Object old = properties.put(IdentifiedObject.NAME_KEY, name);
if (old != null) {
@@ -405,8 +406,8 @@ public abstract class Builder<B extends
/**
* Adds an {@code IdentifiedObject} name fully specified by the given
generic name.
- * This method ignores the authority, {@linkplain #codespace(Citation,
String) code space} or
- * {@linkplain #version(String) version} specified to this builder (if
any), since the given
+ * This method ignores the authority, {@link #setCodeSpace(Citation,
String) code space} or
+ * {@link #setVersion(String) version} specified to this builder (if any),
since the given
* generic name already contains those information.
*
* {@section Name and aliases}
@@ -420,7 +421,7 @@ public abstract class Builder<B extends
* @param name The {@code IdentifiedObject} name as an identifier.
* @return {@code this}, for method call chaining.
*/
- public B name(final GenericName name) {
+ public B addName(final GenericName name) {
ensureNonNull("name", name);
if (properties.get(IdentifiedObject.NAME_KEY) == null) {
properties.put(IdentifiedObject.NAME_KEY, new
NamedIdentifier(name));
@@ -432,8 +433,8 @@ public abstract class Builder<B extends
/**
* Adds an {@code IdentifiedObject} identifier given by a {@code String}.
- * The given string will be combined with the authority, {@linkplain
#codespace(Citation, String) code space}
- * and {@linkplain #version(String) version} information for creating the
{@link ReferenceIdentifier} object.
+ * The given string will be combined with the authority, {@link
#setCodeSpace(Citation, String) code space}
+ * and {@link #setVersion(String) version} information for creating the
{@link ReferenceIdentifier} object.
*
* <p><b>Lifetime:</b>
* all identifiers are cleared after a {@code createXXX(…)} method has
been invoked.</p>
@@ -441,7 +442,7 @@ public abstract class Builder<B extends
* @param identifier The {@code IdentifiedObject} identifier.
* @return {@code this}, for method call chaining.
*/
- public B identifier(final String identifier) {
+ public B addIdentifier(final String identifier) {
ensureNonNull("identifier", identifier);
identifiers.add(new ImmutableIdentifier((Citation)
properties.get(ReferenceIdentifier.AUTHORITY_KEY),
(String) properties.get(ReferenceIdentifier.CODESPACE_KEY),
identifier));
@@ -450,7 +451,7 @@ public abstract class Builder<B extends
/**
* Adds an {@code IdentifiedObject} identifier in an alternative namespace.
- * This method is typically invoked in complement to {@link
#name(Citation, CharSequence)}.
+ * This method is typically invoked in complement to {@link
#addName(Citation, CharSequence)}.
*
* <p><b>Lifetime:</b>
* all identifiers are cleared after a {@code createXXX(…)} method has
been invoked.</p>
@@ -459,9 +460,9 @@ public abstract class Builder<B extends
* @param identifier The {@code IdentifiedObject} identifier as a code in
the namespace of the given authority.
* @return {@code this}, for method call chaining.
*
- * @see #name(Citation, CharSequence)
+ * @see #addName(Citation, CharSequence)
*/
- public B identifier(final Citation authority, final String identifier) {
+ public B addIdentifier(final Citation authority, final String identifier) {
ensureNonNull("identifier", identifier);
identifiers.add(new ImmutableIdentifier(authority,
Citations.getIdentifier(authority), identifier));
return self();
@@ -469,8 +470,8 @@ public abstract class Builder<B extends
/**
* Adds an {@code IdentifiedObject} identifier fully specified by the
given identifier.
- * This method ignores the authority, {@linkplain #codespace(Citation,
String) code space} or
- * {@linkplain #version(String) version} specified to this builder (if
any), since the given
+ * This method ignores the authority, {@link #setCodeSpace(Citation,
String) code space} or
+ * {@link #setVersion(String) version} specified to this builder (if any),
since the given
* identifier already contains those information.
*
* <p><b>Lifetime:</b>
@@ -479,7 +480,7 @@ public abstract class Builder<B extends
* @param identifier The {@code IdentifiedObject} identifier.
* @return {@code this}, for method call chaining.
*/
- public B identifier(final ReferenceIdentifier identifier) {
+ public B addIdentifier(final ReferenceIdentifier identifier) {
ensureNonNull("identifier", identifier);
identifiers.add(identifier);
return self();
@@ -490,13 +491,13 @@ public abstract class Builder<B extends
* Calls to this method overwrite any previous value.
*
* <p><b>Lifetime:</b>
- * previous remarks are discarded by calls to {@code remarks(…)}.
+ * previous remarks are discarded by calls to {@code setRemarks(…)}.
* Remarks are cleared after a {@code createXXX(…)} method has been
invoked.</p>
*
* @param remarks The remarks, or {@code null} if none.
* @return {@code this}, for method call chaining.
*/
- public B remarks(final CharSequence remarks) {
+ public B setRemarks(final CharSequence remarks) {
properties.put(IdentifiedObject.REMARKS_KEY, remarks);
return self();
}
Modified:
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/parameter/ParameterBuilderTest.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/parameter/ParameterBuilderTest.java?rev=1574957&r1=1574956&r2=1574957&view=diff
==============================================================================
---
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/parameter/ParameterBuilderTest.java
[UTF-8] (original)
+++
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/parameter/ParameterBuilderTest.java
[UTF-8] Thu Mar 6 16:46:50 2014
@@ -49,16 +49,16 @@ public final strictfp class ParameterBui
@Test
public void testMercatorProjection() {
final ParameterBuilder builder = new ParameterBuilder();
- builder.codespace(HardCodedCitations.OGP, "EPSG").mandatory();
+ builder.setCodeSpace(HardCodedCitations.OGP, "EPSG").setRequired(true);
final ParameterDescriptor[] parameters = {
- builder.name("Longitude of natural origin")
- .name(HardCodedCitations.OGC, "central_meridian")
- .name(HardCodedCitations.GEOTIFF, "NatOriginLong")
- .remarks("Some remarks.")
.createBounded(-180, +180, 0, NonSI.DEGREE_ANGLE),
- builder.name("Latitude of natural origin") .createBounded(
-80, +84, 0, NonSI.DEGREE_ANGLE),
- builder.name("Scale factor at natural origin")
.createStrictlyPositive(1, Unit.ONE),
- builder.name("False easting") .create(0,
SI.METRE),
- builder.name("False northing") .create(0, SI.METRE)
+ builder.addName("Longitude of natural origin")
+ .addName(HardCodedCitations.OGC, "central_meridian")
+ .addName(HardCodedCitations.GEOTIFF, "NatOriginLong")
+ .setRemarks("Some remarks.")
.createBounded(-180, +180, 0, NonSI.DEGREE_ANGLE),
+ builder.addName("Latitude of natural origin") .createBounded(
-80, +84, 0, NonSI.DEGREE_ANGLE),
+ builder.addName("Scale factor at natural origin")
.createStrictlyPositive(1, Unit.ONE),
+ builder.addName("False easting") .create(0,
SI.METRE),
+ builder.addName("False northing") .create(0,
SI.METRE)
};
// Tests random properties.
assertEquals("EPSG",
parameters[1].getName().getCodeSpace());
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=1574957&r1=1574956&r2=1574957&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 16:46:50 2014
@@ -50,6 +50,7 @@ public final strictfp class BuilderTest
}
try {
new Invalid();
+ fail("Creation of Invalid builder shall not be allowed.");
} catch (AssertionError e) {
final String message = e.getMessage();
assertTrue(message, message.contains(BuilderMock.class.getName()));
@@ -57,20 +58,20 @@ public final strictfp class BuilderTest
}
/**
- * Tests {@link Builder#codespace(Citation, String)}.
+ * Tests {@link Builder#setCodeSpace(Citation, String)}.
*/
@Test
- public void testCodespace() {
+ public void testSetCodeSpace() {
final BuilderMock builder = new BuilderMock();
- builder.codespace(OGP, "EPSG");
- builder.name("Mercator (variant A)");
+ builder.setCodeSpace(OGP, "EPSG");
+ builder.addName("Mercator (variant A)");
/*
* Setting the same codespace should have no effect, while attempt to
* set a new codespace after we added a name shall not be allowed.
*/
- builder.codespace(OGP, "EPSG");
+ builder.setCodeSpace(OGP, "EPSG");
try {
- builder.codespace(EPSG, "EPSG");
+ builder.setCodeSpace(EPSG, "EPSG");
fail("Setting a different codespace shall not be allowed.");
} catch (IllegalStateException e) {
final String message = e.getMessage();
@@ -88,13 +89,13 @@ public final strictfp class BuilderTest
builder.onCreate(true);
assertEquals("EPSG",
builder.properties.get(ReferenceIdentifier.CODESPACE_KEY));
assertSame ( OGP,
builder.properties.get(ReferenceIdentifier.AUTHORITY_KEY));
- builder.codespace(EPSG, "EPSG");
+ builder.setCodeSpace(EPSG, "EPSG");
assertEquals("EPSG",
builder.properties.get(ReferenceIdentifier.CODESPACE_KEY));
assertSame ( EPSG,
builder.properties.get(ReferenceIdentifier.AUTHORITY_KEY));
}
/**
- * Tests {@link Builder#name(CharSequence)} without codespace.
+ * Tests {@link Builder#addName(CharSequence)} without codespace.
*/
@Test
public void testUnscopedName() {
@@ -110,10 +111,10 @@ public final strictfp class BuilderTest
// The test.
final BuilderMock builder = new BuilderMock();
- 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
+ assertSame(builder, builder.addName("Mercator (variant A)")); //
EPSG version 7.6 and later.
+ assertSame(builder, builder.addName("Mercator (1SP)")); //
EPSG before version 7.6.
+ assertSame(builder, builder.addName("Mercator_1SP")); // OGC
+ assertSame(builder, builder.addName("CT_Mercator")); //
GeoTIFF
builder.onCreate(false);
assertEquals(name, builder.properties.get(NAME_KEY));
assertArrayEquals(new GenericName[] {alias1, alias2, alias3},
@@ -121,10 +122,10 @@ public final strictfp class BuilderTest
}
/**
- * Tests {@link Builder#name(Citation, CharSequence)} and {@link
Builder#name(CharSequence)} with codespace.
+ * Tests {@link Builder#addName(Citation, CharSequence)} and {@link
Builder#addName(CharSequence)} with codespace.
*/
@Test
- @DependsOnMethod({"testUnscopedName", "testCodespace"})
+ @DependsOnMethod({"testUnscopedName", "testSetCodeSpace"})
public void testScopedName() {
// Expected values to be used later in the test.
final String name = "Mercator (variant A)";
@@ -139,11 +140,11 @@ public final strictfp class BuilderTest
// The test.
final BuilderMock builder = new BuilderMock();
- 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"));
+ assertSame(builder, builder.setCodeSpace(OGP, "EPSG"));
+ assertSame(builder, builder.addName( "Mercator (variant A)"));
+ assertSame(builder, builder.addName( "Mercator (1SP)"));
+ assertSame(builder, builder.addName(OGC, "Mercator_1SP"));
+ assertSame(builder, builder.addName(GEOTIFF, "CT_Mercator"));
builder.onCreate(false);
assertEquals(name, builder.properties.get(NAME_KEY));
assertArrayEquals(new GenericName[] {alias1, alias2, alias3},
@@ -158,7 +159,7 @@ public final strictfp class BuilderTest
}
/**
- * Tests {@link Builder#identifier(Citation, String)} and {@link
Builder#identifier(String)}
+ * Tests {@link Builder#addIdentifier(Citation, String)} and {@link
Builder#addIdentifier(String)}
* with codespace.
*/
@Test
@@ -171,9 +172,9 @@ public final strictfp class BuilderTest
// The test.
final BuilderMock builder = new BuilderMock();
- assertSame(builder, builder.codespace (OGP, "EPSG"));
- assertSame(builder, builder.identifier( "9804"));
- assertSame(builder, builder.identifier(GEOTIFF, "7"));
+ assertSame(builder, builder.setCodeSpace (OGP, "EPSG"));
+ assertSame(builder, builder.addIdentifier( "9804"));
+ assertSame(builder, builder.addIdentifier(GEOTIFF, "7"));
builder.onCreate(false);
assertArrayEquals(new ReferenceIdentifier[] {id1, id2},
(ReferenceIdentifier[])
builder.properties.get(IDENTIFIERS_KEY));
Modified: sis/branches/JDK7/src/main/javadoc/stylesheet.css
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/src/main/javadoc/stylesheet.css?rev=1574957&r1=1574956&r2=1574957&view=diff
==============================================================================
--- sis/branches/JDK7/src/main/javadoc/stylesheet.css (original)
+++ sis/branches/JDK7/src/main/javadoc/stylesheet.css Thu Mar 6 16:46:50 2014
@@ -64,7 +64,7 @@
/*
* Table without vertical space between rows and a little bit of space between
columns.
- * This table has no border. Headers are still centered and other cells
left-aligned.
+ * This table has no border and text is left-aligned.
*/
.contentContainer .block table.compact,
.contentContainer ul.blockList ul.blockList li.blockList table.compact