sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject [sis] 03/05: Factorize a common pattern in 'toString()' implementations.
Date Thu, 03 Jan 2019 16:01:49 GMT
This is an automated email from the ASF dual-hosted git repository.

desruisseaux pushed a commit to branch geoapi-4.0
in repository https://gitbox.apache.org/repos/asf/sis.git

commit 1d795d49fc152c810959936af85f36ddf5f5fdfe
Author: Martin Desruisseaux <martin.desruisseaux@geomatys.com>
AuthorDate: Thu Jan 3 11:28:59 2019 +0100

    Factorize a common pattern in 'toString()' implementations.
---
 .../sis/internal/jaxb/IdentifierMapAdapter.java    |  4 +-
 .../apache/sis/internal/jaxb/gml/TimeInstant.java  |  3 +-
 .../apache/sis/internal/jaxb/gml/TimePeriod.java   |  3 +-
 .../sis/internal/metadata/MetadataUtilities.java   |  4 +-
 .../apache/sis/internal/metadata/NameMeaning.java  |  4 +-
 .../sis/internal/simple/CitationConstant.java      |  3 +-
 .../org/apache/sis/metadata/MetadataStandard.java  |  3 +-
 .../apache/sis/metadata/sql/MetadataSource.java    |  3 +-
 .../apache/sis/util/iso/DefaultNameFactory.java    |  3 +-
 .../java/org/apache/sis/xml/NilObjectHandler.java  |  3 +-
 .../apache/sis/test/mock/IdentifiedObjectMock.java |  3 +-
 .../org/apache/sis/coverage/grid/GridExtent.java   |  3 +-
 .../sis/internal/raster/ScaledColorSpace.java      |  4 +-
 .../gazetteer/MilitaryGridReferenceSystem.java     |  3 +-
 .../referencing/j2d/IntervalRectangle.java         |  8 +--
 .../referencing/provider/DatumShiftGridFile.java   |  4 +-
 .../java/org/apache/sis/parameter/Verifier.java    |  5 +-
 .../org/apache/sis/referencing/NameIterator.java   |  2 +-
 .../sis/referencing/datum/DatumShiftGrid.java      |  3 +-
 .../referencing/factory/AuthorityFactoryProxy.java |  3 +-
 .../operation/builder/LinearTransformBuilder.java  |  5 +-
 .../operation/transform/TransformSeparator.java    |  3 +-
 .../internal/util/{Utilities.java => Strings.java} | 64 ++++++++++++++++++----
 .../src/main/java/org/apache/sis/math/Line.java    |  5 +-
 .../src/main/java/org/apache/sis/math/Plane.java   |  7 ++-
 .../main/java/org/apache/sis/measure/Angle.java    |  4 +-
 .../java/org/apache/sis/measure/AngleFormat.java   |  3 +-
 .../main/java/org/apache/sis/measure/Range.java    |  4 +-
 .../main/java/org/apache/sis/util/Characters.java  |  3 +-
 .../sis/util/iso/AbstractInternationalString.java  |  4 +-
 .../sis/util/resources/IndexedResourceBundle.java  |  3 +-
 .../apache/sis/internal/util/UtilitiesTest.java    | 14 ++---
 .../storage/earthobservation/LandsatReader.java    |  4 +-
 .../org/apache/sis/storage/geotiff/CRSBuilder.java |  4 +-
 .../org/apache/sis/storage/netcdf/NetcdfStore.java |  3 +-
 .../java/org/apache/sis/storage/DataStore.java     |  3 +-
 .../java/org/apache/sis/storage/ProbeResult.java   |  6 +-
 .../org/apache/sis/storage/StorageConnector.java   |  4 +-
 .../internal/storage/xml/stream/StaxDataStore.java |  4 +-
 39 files changed, 140 insertions(+), 78 deletions(-)

diff --git a/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/IdentifierMapAdapter.java b/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/IdentifierMapAdapter.java
index 5436045..a634dd8 100644
--- a/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/IdentifierMapAdapter.java
+++ b/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/IdentifierMapAdapter.java
@@ -32,7 +32,7 @@ import org.opengis.metadata.citation.Citation;
 import org.apache.sis.xml.XLink;
 import org.apache.sis.xml.IdentifierMap;
 import org.apache.sis.xml.IdentifierSpace;
-import org.apache.sis.internal.util.Utilities;
+import org.apache.sis.internal.util.Strings;
 import org.apache.sis.internal.util.SetOfUnknownSize;
 
 import static org.apache.sis.util.collection.Containers.hashMapCapacity;
@@ -526,7 +526,7 @@ public class IdentifierMapAdapter extends AbstractMap<Citation,String> implement
          */
         @Override
         public String toString() {
-            return Utilities.toString(Iter.class, "next", next);
+            return Strings.toString(Iter.class, "next", next);
         }
     }
 
diff --git a/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/gml/TimeInstant.java b/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/gml/TimeInstant.java
index 611e527..a18947b 100644
--- a/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/gml/TimeInstant.java
+++ b/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/gml/TimeInstant.java
@@ -24,6 +24,7 @@ import javax.xml.datatype.XMLGregorianCalendar;
 import javax.xml.datatype.DatatypeConfigurationException;
 import org.opengis.temporal.Instant;
 import org.apache.sis.internal.jaxb.Context;
+import org.apache.sis.internal.util.Strings;
 import org.apache.sis.internal.xml.XmlUtilities;
 
 
@@ -102,6 +103,6 @@ public final class TimeInstant extends GMLAdapter {
      */
     @Override
     public String toString() {
-        return "TimeInstant[" + timePosition + ']';
+        return Strings.bracket(getClass(), timePosition);
     }
 }
diff --git a/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/gml/TimePeriod.java b/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/gml/TimePeriod.java
index 5a66b04..71c4ff8 100644
--- a/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/gml/TimePeriod.java
+++ b/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/gml/TimePeriod.java
@@ -22,6 +22,7 @@ import javax.xml.bind.annotation.XmlElements;
 import javax.xml.bind.annotation.XmlRootElement;
 import org.opengis.temporal.Period;
 import org.apache.sis.internal.jaxb.Context;
+import org.apache.sis.internal.util.Strings;
 
 import static org.apache.sis.internal.xml.LegacyNamespaces.VERSION_3_0;
 
@@ -95,6 +96,6 @@ public final class TimePeriod extends GMLAdapter {
      */
     @Override
     public String toString() {
-        return "TimePeriod[" + begin + " … " + end + ']';
+        return Strings.range(getClass(), begin, end);
     }
 }
diff --git a/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/MetadataUtilities.java b/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/MetadataUtilities.java
index cf17acb..36f6bef 100644
--- a/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/MetadataUtilities.java
+++ b/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/MetadataUtilities.java
@@ -25,7 +25,7 @@ import org.apache.sis.util.Static;
 import org.apache.sis.util.CharSequences;
 import org.apache.sis.util.resources.Errors;
 import org.apache.sis.internal.jaxb.Context;
-import org.apache.sis.internal.util.Utilities;
+import org.apache.sis.internal.util.Strings;
 
 
 /**
@@ -213,7 +213,7 @@ public final class MetadataUtilities extends Static {
             id = object.getIdentifierMap().getSpecialized(IdentifierSpace.ID);
             if (id != null) {
                 final StringBuilder buffer = new StringBuilder();
-                if (!Utilities.appendUnicodeIdentifier(buffer, (char) 0, id, ":-", false)) {
+                if (!Strings.appendUnicodeIdentifier(buffer, (char) 0, id, ":-", false)) {
                     return null;
                 }
                 id = buffer.toString();
diff --git a/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/NameMeaning.java b/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/NameMeaning.java
index 2762716..c2ca1da 100644
--- a/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/NameMeaning.java
+++ b/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/NameMeaning.java
@@ -29,7 +29,7 @@ import org.opengis.referencing.operation.*;
 import org.opengis.util.InternationalString;
 import org.opengis.metadata.citation.Citation;
 import org.apache.sis.util.Static;
-import org.apache.sis.internal.util.Utilities;
+import org.apache.sis.internal.util.Strings;
 import org.apache.sis.internal.util.Constants;
 import org.apache.sis.internal.util.DefinitionURI;
 import org.apache.sis.metadata.iso.citation.Citations;
@@ -199,7 +199,7 @@ loop:   for (int p=0; ; p++) {
                 case 3:  part = code;               break;
                 default: break loop;
             }
-            if (!Utilities.appendUnicodeIdentifier(buffer.append(DefinitionURI.SEPARATOR), '\u0000', part, ".-", false)) {
+            if (!Strings.appendUnicodeIdentifier(buffer.append(DefinitionURI.SEPARATOR), '\u0000', part, ".-", false)) {
                 /*
                  * Only the version (p = 2) is optional. All other fields are mandatory.
                  * If no character has been added for a mandatory field, we can not build a URN.
diff --git a/core/sis-metadata/src/main/java/org/apache/sis/internal/simple/CitationConstant.java b/core/sis-metadata/src/main/java/org/apache/sis/internal/simple/CitationConstant.java
index 55a15e1..727627b 100644
--- a/core/sis-metadata/src/main/java/org/apache/sis/internal/simple/CitationConstant.java
+++ b/core/sis-metadata/src/main/java/org/apache/sis/internal/simple/CitationConstant.java
@@ -33,6 +33,7 @@ import org.apache.sis.metadata.sql.MetadataSource;
 import org.apache.sis.metadata.sql.MetadataStoreException;
 import org.apache.sis.metadata.iso.citation.Citations;
 import org.apache.sis.internal.system.Loggers;
+import org.apache.sis.internal.util.Strings;
 import org.apache.sis.util.logging.Logging;
 
 
@@ -107,7 +108,7 @@ public class CitationConstant extends SimpleCitation {
          */
         @Override
         public final String toString() {
-            return "IdentifierSpace[" + title + ']';
+            return Strings.bracket(IdentifierSpace.class, title);
         }
     }
 
diff --git a/core/sis-metadata/src/main/java/org/apache/sis/metadata/MetadataStandard.java b/core/sis-metadata/src/main/java/org/apache/sis/metadata/MetadataStandard.java
index daf4667..7d02300 100644
--- a/core/sis-metadata/src/main/java/org/apache/sis/metadata/MetadataStandard.java
+++ b/core/sis-metadata/src/main/java/org/apache/sis/metadata/MetadataStandard.java
@@ -40,6 +40,7 @@ import org.apache.sis.internal.system.Semaphores;
 import org.apache.sis.internal.system.SystemListener;
 import org.apache.sis.internal.simple.SimpleCitation;
 import org.apache.sis.internal.util.FinalFieldSetter;
+import org.apache.sis.internal.util.Strings;
 
 import static org.apache.sis.util.ArgumentChecks.ensureNonNull;
 import static org.apache.sis.util.ArgumentChecks.ensureNonNullElement;
@@ -1055,7 +1056,7 @@ public class MetadataStandard implements Serializable {
      */
     @Override
     public String toString() {
-        return Classes.getShortClassName(this) + '[' + citation.getTitle() + ']';
+        return Strings.bracket(getClass(), citation.getTitle());
     }
 
     /**
diff --git a/core/sis-metadata/src/main/java/org/apache/sis/metadata/sql/MetadataSource.java b/core/sis-metadata/src/main/java/org/apache/sis/metadata/sql/MetadataSource.java
index 99722ca..16396c1 100644
--- a/core/sis-metadata/src/main/java/org/apache/sis/metadata/sql/MetadataSource.java
+++ b/core/sis-metadata/src/main/java/org/apache/sis/metadata/sql/MetadataSource.java
@@ -59,6 +59,7 @@ import org.apache.sis.internal.metadata.sql.Initializer;
 import org.apache.sis.internal.metadata.sql.Reflection;
 import org.apache.sis.internal.metadata.sql.SQLBuilder;
 import org.apache.sis.internal.system.Loggers;
+import org.apache.sis.internal.util.Strings;
 import org.apache.sis.internal.util.CollectionsExt;
 import org.apache.sis.internal.util.UnmodifiableArrayList;
 import org.apache.sis.util.collection.Containers;
@@ -966,7 +967,7 @@ public class MetadataSource implements AutoCloseable {
                         element = info.convert(elementType, element);
                     } catch (UnconvertibleObjectException e) {
                         throw new MetadataStoreException(Errors.format(Errors.Keys.IllegalPropertyValueClass_3,
-                                columnName + '[' + i + ']', elementType, element.getClass()), e);
+                                Strings.toIndexed(columnName, i), elementType, element.getClass()), e);
                     }
                 }
                 values[i] = element;
diff --git a/core/sis-metadata/src/main/java/org/apache/sis/util/iso/DefaultNameFactory.java b/core/sis-metadata/src/main/java/org/apache/sis/util/iso/DefaultNameFactory.java
index f20347a..203fbec 100644
--- a/core/sis-metadata/src/main/java/org/apache/sis/util/iso/DefaultNameFactory.java
+++ b/core/sis-metadata/src/main/java/org/apache/sis/util/iso/DefaultNameFactory.java
@@ -32,6 +32,7 @@ import org.opengis.util.NameFactory;
 import org.opengis.util.InternationalString;
 import org.apache.sis.util.resources.Errors;
 import org.apache.sis.util.collection.WeakHashSet;
+import org.apache.sis.internal.util.Strings;
 
 import static org.apache.sis.util.ArgumentChecks.ensureNonNull;
 import static org.apache.sis.util.iso.DefaultNameSpace.DEFAULT_SEPARATOR_STRING;
@@ -379,7 +380,7 @@ public class DefaultNameFactory extends AbstractFactory implements NameFactory {
                 name = toGenericName(value);
                 if (name == null) {
                     throw new ClassCastException(Errors.format(Errors.Keys.IllegalArgumentClass_2,
-                            "value[" + i + ']', value.getClass()));
+                            Strings.toIndexed("value", i), value.getClass()));
                 }
                 names[i] = name;
             }
diff --git a/core/sis-metadata/src/main/java/org/apache/sis/xml/NilObjectHandler.java b/core/sis-metadata/src/main/java/org/apache/sis/xml/NilObjectHandler.java
index acd8b0a..bf4ce28 100644
--- a/core/sis-metadata/src/main/java/org/apache/sis/xml/NilObjectHandler.java
+++ b/core/sis-metadata/src/main/java/org/apache/sis/xml/NilObjectHandler.java
@@ -31,6 +31,7 @@ import org.apache.sis.util.Numbers;
 import org.apache.sis.util.ComparisonMode;
 import org.apache.sis.util.LenientComparable;
 import org.apache.sis.util.resources.Errors;
+import org.apache.sis.internal.util.Strings;
 import org.apache.sis.internal.jaxb.IdentifierMapAdapter;
 import org.apache.sis.internal.jaxb.ModifiableIdentifierMap;
 
@@ -136,7 +137,7 @@ final class NilObjectHandler implements InvocationHandler {
                             ((IdentifierMapAdapter) attribute).identifiers : null;
                 }
                 case "toString": {
-                    return getInterface(proxy).getSimpleName() + '[' + attribute + ']';
+                    return Strings.bracket(getInterface(proxy), attribute);
                 }
                 case "hashCode": {
                     return ~attribute.hashCode();
diff --git a/core/sis-metadata/src/test/java/org/apache/sis/test/mock/IdentifiedObjectMock.java b/core/sis-metadata/src/test/java/org/apache/sis/test/mock/IdentifiedObjectMock.java
index 5663d47..74ad840 100644
--- a/core/sis-metadata/src/test/java/org/apache/sis/test/mock/IdentifiedObjectMock.java
+++ b/core/sis-metadata/src/test/java/org/apache/sis/test/mock/IdentifiedObjectMock.java
@@ -28,6 +28,7 @@ import org.opengis.util.InternationalString;
 import org.opengis.metadata.Identifier;
 import org.opengis.metadata.citation.Citation;
 import org.opengis.referencing.IdentifiedObject;
+import org.apache.sis.internal.util.Strings;
 import org.apache.sis.internal.util.CollectionsExt;
 import org.apache.sis.internal.jaxb.gco.GO_GenericName;
 
@@ -204,7 +205,7 @@ public strictfp class IdentifiedObjectMock implements IdentifiedObject, Identifi
      */
     @Override
     public final String toString() {
-        return getClass().getSimpleName() + '[' + code + ']';
+        return Strings.bracket(getClass(), code);
     }
 
     /**
diff --git a/core/sis-raster/src/main/java/org/apache/sis/coverage/grid/GridExtent.java b/core/sis-raster/src/main/java/org/apache/sis/coverage/grid/GridExtent.java
index 49cc364..b1a1f9b 100644
--- a/core/sis-raster/src/main/java/org/apache/sis/coverage/grid/GridExtent.java
+++ b/core/sis-raster/src/main/java/org/apache/sis/coverage/grid/GridExtent.java
@@ -40,6 +40,7 @@ import org.apache.sis.util.collection.WeakValueHashMap;
 import org.apache.sis.internal.metadata.AxisDirections;
 import org.apache.sis.internal.raster.Resources;
 import org.apache.sis.internal.util.Numerics;
+import org.apache.sis.internal.util.Strings;
 import org.apache.sis.geometry.AbstractEnvelope;
 import org.apache.sis.geometry.GeneralEnvelope;
 import org.apache.sis.geometry.Envelopes;
@@ -813,7 +814,7 @@ public class GridExtent implements Serializable {
                 sub.coordinates[i] = low /= s;
                 sub.coordinates[j] = low + r;
             } else if (s <= 0) {
-                throw new IllegalArgumentException(Errors.format(Errors.Keys.ValueNotGreaterThanZero_2, "strides[" + i + ']', s));
+                throw new IllegalArgumentException(Errors.format(Errors.Keys.ValueNotGreaterThanZero_2, Strings.toIndexed("strides", i), s));
             }
         }
         return Arrays.equals(coordinates, sub.coordinates) ? this : sub;
diff --git a/core/sis-raster/src/main/java/org/apache/sis/internal/raster/ScaledColorSpace.java b/core/sis-raster/src/main/java/org/apache/sis/internal/raster/ScaledColorSpace.java
index c6d15ac..8f745f1 100644
--- a/core/sis-raster/src/main/java/org/apache/sis/internal/raster/ScaledColorSpace.java
+++ b/core/sis-raster/src/main/java/org/apache/sis/internal/raster/ScaledColorSpace.java
@@ -17,7 +17,7 @@
 package org.apache.sis.internal.raster;
 
 import java.awt.color.ColorSpace;
-import org.apache.sis.util.Classes;
+import org.apache.sis.internal.util.Strings;
 
 
 /**
@@ -166,6 +166,6 @@ public final class ScaledColorSpace extends ColorSpace {
      */
     @Override
     public String toString() {
-        return Classes.getShortClassName(this) + '[' + getMinValue(visibleBand) + " … " + getMaxValue(visibleBand) + ']';
+        return Strings.range(getClass(), getMinValue(visibleBand), getMaxValue(visibleBand));
     }
 }
diff --git a/core/sis-referencing-by-identifiers/src/main/java/org/apache/sis/referencing/gazetteer/MilitaryGridReferenceSystem.java b/core/sis-referencing-by-identifiers/src/main/java/org/apache/sis/referencing/gazetteer/MilitaryGridReferenceSystem.java
index d955742..1d6a6e8 100644
--- a/core/sis-referencing-by-identifiers/src/main/java/org/apache/sis/referencing/gazetteer/MilitaryGridReferenceSystem.java
+++ b/core/sis-referencing-by-identifiers/src/main/java/org/apache/sis/referencing/gazetteer/MilitaryGridReferenceSystem.java
@@ -66,6 +66,7 @@ import org.apache.sis.geometry.Envelopes;
 import org.apache.sis.geometry.Envelope2D;
 import org.apache.sis.geometry.DirectPosition2D;
 import org.apache.sis.internal.system.Modules;
+import org.apache.sis.internal.util.Strings;
 import org.apache.sis.math.DecimalFunctions;
 import org.apache.sis.measure.Longitude;
 import org.apache.sis.measure.Latitude;
@@ -1283,7 +1284,7 @@ public class MilitaryGridReferenceSystem extends ReferencingByIdentifiers {
          */
         @Override
         public String toString() {
-            return org.apache.sis.internal.util.Utilities.toString(getClass(), "zone", encoder.crsZone,
+            return Strings.toString(getClass(), "zone", encoder.crsZone,
                     "downward", downward, "yStart", yStart, "yEnd", yEnd, "gridX", gridX, "xEnd", xEnd);
         }
     }
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/j2d/IntervalRectangle.java b/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/j2d/IntervalRectangle.java
index 1d409de..620e314 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/j2d/IntervalRectangle.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/j2d/IntervalRectangle.java
@@ -20,7 +20,7 @@ import java.awt.geom.Rectangle2D;
 import org.opengis.geometry.Envelope;
 import org.opengis.geometry.DirectPosition;
 import org.apache.sis.geometry.Envelope2D;
-import org.apache.sis.util.Classes;
+import org.apache.sis.internal.util.Strings;
 
 
 /**
@@ -512,10 +512,6 @@ public class IntervalRectangle extends Rectangle2D {
      */
     @Override
     public String toString() {
-        return Classes.getShortClassName(this) +
-                "[xmin=" + xmin +
-                " ymin=" + ymin +
-                " xmax=" + xmax +
-                " ymax=" + ymax + ']';
+        return Strings.toString(getClass(), "xmin", xmin, "ymin", ymin, "xmax", xmax, "ymax", ymax);
     }
 }
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/DatumShiftGridFile.java b/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/DatumShiftGridFile.java
index 0e11997..e62974f 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/DatumShiftGridFile.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/DatumShiftGridFile.java
@@ -32,7 +32,7 @@ import org.apache.sis.parameter.Parameters;
 import org.apache.sis.referencing.datum.DatumShiftGrid;
 import org.apache.sis.referencing.operation.transform.LinearTransform;
 import org.apache.sis.internal.referencing.j2d.AffineTransform2D;
-import org.apache.sis.internal.util.Utilities;
+import org.apache.sis.internal.util.Strings;
 
 
 /**
@@ -316,7 +316,7 @@ public abstract class DatumShiftGridFile<C extends Quantity<C>, T extends Quanti
      */
     @Override
     public String toString() {
-        return Utilities.toString(getClass(), "file", (files.length != 0) ? files[0] : null);
+        return Strings.toString(getClass(), "file", (files.length != 0) ? files[0] : null);
     }
 
 
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/parameter/Verifier.java b/core/sis-referencing/src/main/java/org/apache/sis/parameter/Verifier.java
index 2bf01c6..94b797a 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/parameter/Verifier.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/parameter/Verifier.java
@@ -32,6 +32,7 @@ import org.apache.sis.internal.referencing.EPSGParameterDomain;
 import org.apache.sis.internal.referencing.Resources;
 import org.apache.sis.internal.system.Semaphores;
 import org.apache.sis.internal.system.Loggers;
+import org.apache.sis.internal.util.Strings;
 import org.apache.sis.measure.Range;
 import org.apache.sis.measure.Units;
 import org.apache.sis.util.Numbers;
@@ -182,7 +183,7 @@ final class Verifier {
                                 n = Numbers.cast(n, componentType.asSubclass(Number.class));
                             } catch (IllegalArgumentException e) {
                                 throw new InvalidParameterValueException(e.getLocalizedMessage(),
-                                        getDisplayName(descriptor) + '[' + i + ']', value);
+                                        Strings.toIndexed(getDisplayName(descriptor), i), value);
                             }
                             Array.set(convertedValue, i, n);
                         }
@@ -350,7 +351,7 @@ final class Verifier {
     String message(final Map<?,?> properties, String name, Object value) {
         final Object index = arguments[0];
         if (index != null) {
-            name = name + '[' + index + ']';
+            name = Strings.bracket(name, index);
             value = Array.get(value, (Integer) index);
         }
         arguments[0] = name;
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/NameIterator.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/NameIterator.java
index 0a57422..dfce1d0 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/NameIterator.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/NameIterator.java
@@ -25,7 +25,7 @@ import org.apache.sis.internal.jaxb.Context;
 import org.apache.sis.internal.metadata.NameMeaning;
 import org.apache.sis.internal.referencing.NilReferencingObject;
 
-import static org.apache.sis.internal.util.Utilities.appendUnicodeIdentifier;
+import static org.apache.sis.internal.util.Strings.appendUnicodeIdentifier;
 
 
 /**
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DatumShiftGrid.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DatumShiftGrid.java
index 5a76f86..ba4f63c 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DatumShiftGrid.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DatumShiftGrid.java
@@ -31,6 +31,7 @@ import org.apache.sis.referencing.operation.transform.LinearTransform;
 import org.apache.sis.geometry.GeneralEnvelope;
 import org.apache.sis.geometry.Envelopes;
 import org.apache.sis.internal.util.DoubleDouble;
+import org.apache.sis.internal.util.Strings;
 import org.apache.sis.util.resources.Errors;
 import org.apache.sis.util.ArgumentChecks;
 import org.apache.sis.measure.Units;
@@ -223,7 +224,7 @@ public abstract class DatumShiftGrid<C extends Quantity<C>, T extends Quantity<T
             if ((n = gridSize[i]) < 2) {
                 throw new IllegalArgumentException(Errors.format(n <= 0
                         ? Errors.Keys.ValueNotGreaterThanZero_2
-                        : Errors.Keys.IllegalArgumentValue_2, "gridSize[" + i + ']', n));
+                        : Errors.Keys.IllegalArgumentValue_2, Strings.toIndexed("gridSize", i), n));
             }
         }
         computeConversionFactors();
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/AuthorityFactoryProxy.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/AuthorityFactoryProxy.java
index bf5f6ac..5d7feaf 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/AuthorityFactoryProxy.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/AuthorityFactoryProxy.java
@@ -31,6 +31,7 @@ import org.opengis.metadata.extent.Extent;
 import org.opengis.util.FactoryException;
 import org.opengis.util.InternationalString;
 import org.apache.sis.util.resources.Errors;
+import org.apache.sis.internal.util.Strings;
 
 
 /**
@@ -86,7 +87,7 @@ abstract class AuthorityFactoryProxy<T> {
      */
     @Override
     public String toString() {
-        return "AuthorityFactoryProxy[" + type.getSimpleName() + ']';
+        return Strings.bracket(AuthorityFactoryProxy.class, type.getSimpleName());
     }
 
     /**
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/builder/LinearTransformBuilder.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/builder/LinearTransformBuilder.java
index db73058..899e444 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/builder/LinearTransformBuilder.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/builder/LinearTransformBuilder.java
@@ -43,6 +43,7 @@ import org.apache.sis.referencing.factory.InvalidGeodeticParameterException;
 import org.apache.sis.internal.referencing.ExtendedPrecisionMatrix;
 import org.apache.sis.internal.referencing.Resources;
 import org.apache.sis.internal.util.AbstractMap;
+import org.apache.sis.internal.util.Strings;
 import org.apache.sis.util.resources.Vocabulary;
 import org.apache.sis.util.resources.Errors;
 import org.apache.sis.util.ArgumentChecks;
@@ -312,8 +313,8 @@ search: for (int j=numPoints; --j >= 0;) {
      * with {@link #numPoints} the index of the next point that we failed to add.
      */
     private MismatchedDimensionException mismatchedDimension(final String name, final int expected, final int actual) {
-        return new MismatchedDimensionException(Errors.format(
-                Errors.Keys.MismatchedDimension_3, name + '[' + numPoints + ']', expected, actual));
+        return new MismatchedDimensionException(Errors.format(Errors.Keys.MismatchedDimension_3,
+                    Strings.toIndexed(name, numPoints), expected, actual));
     }
 
     /**
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/TransformSeparator.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/TransformSeparator.java
index 7aac9aa..7486453 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/TransformSeparator.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/TransformSeparator.java
@@ -24,6 +24,7 @@ import org.opengis.referencing.operation.MathTransformFactory;
 import org.apache.sis.referencing.operation.matrix.MatrixSIS;
 import org.apache.sis.referencing.operation.matrix.Matrices;
 import org.apache.sis.internal.referencing.Resources;
+import org.apache.sis.internal.util.Strings;
 import org.apache.sis.util.resources.Errors;
 import org.apache.sis.util.ArgumentChecks;
 import org.apache.sis.util.ArraysExt;
@@ -192,7 +193,7 @@ public class TransformSeparator {
             final int value = sequence[i];
             if (value <= previous || value >= max) {
                 throw new IllegalArgumentException(Errors.format(Errors.Keys.ValueOutOfRange_4,
-                        "dimensions[" + (i - offset) + ']', previous + 1, max - 1, value));
+                        Strings.toIndexed("dimensions", i - offset), previous + 1, max - 1, value));
             }
             previous = value;
         }
diff --git a/core/sis-utility/src/main/java/org/apache/sis/internal/util/Utilities.java b/core/sis-utility/src/main/java/org/apache/sis/internal/util/Strings.java
similarity index 83%
rename from core/sis-utility/src/main/java/org/apache/sis/internal/util/Utilities.java
rename to core/sis-utility/src/main/java/org/apache/sis/internal/util/Strings.java
index 84e7b8b..117dcb0 100644
--- a/core/sis-utility/src/main/java/org/apache/sis/internal/util/Utilities.java
+++ b/core/sis-utility/src/main/java/org/apache/sis/internal/util/Strings.java
@@ -26,17 +26,18 @@ import org.apache.sis.util.CharSequences;
 
 /**
  * Miscellaneous utilities which should not be put in public API.
+ * Most of those methods are for {@link Object#toString()} implementations.
  *
  * @author  Martin Desruisseaux (Geomatys)
- * @version 0.8
+ * @version 1.0
  * @since   0.3
  * @module
  */
-public final class Utilities extends Static {
+public final class Strings extends Static {
     /**
      * Do not allow instantiation of this class.
      */
-    private Utilities() {
+    private Strings() {
     }
 
     /**
@@ -92,6 +93,55 @@ public final class Utilities extends Static {
     }
 
     /**
+     * Appends {@code "[index]"} to the given name. This is used for formatting error messages.
+     *
+     * @param  name   the variable name to which to append "[index]".
+     * @param  index  value to write between brackets.
+     * @return {@code "name[index]"}.
+     */
+    public static String toIndexed(final String name, final int index) {
+        return name + '[' + index + ']';
+    }
+
+    /**
+     * Formats {@code "name[index]"}.
+     *
+     * @param  name   the variable name to which to append "[index]".
+     * @param  index  value to write between brackets.
+     * @return {@code "name[index]"}.
+     */
+    public static String bracket(final String name, final Object index) {
+        if (index instanceof CharSequence) {
+            return name + "[“" + index + "”]";
+        } else {
+            return name + '[' + index + ']';
+        }
+    }
+
+    /**
+     * Formats {@code "classname[index]"}.
+     *
+     * @param  type   the type to which to append "[index]".
+     * @param  index  value to write between brackets.
+     * @return {@code "classname[index]"}.
+     */
+    public static String bracket(final Class<?> type, final Object index) {
+        return bracket(Classes.getShortName(type), index);
+    }
+
+    /**
+     * Formats {@code "classname[lower … upper]"}.
+     *
+     * @param  type   the type to which to append "[lower … upper]".
+     * @param  lower  first value to write between brackets.
+     * @param  upper  second value to write between brackets.
+     * @return {@code "classname[lower … upper]"}.
+     */
+    public static String range(final Class<?> type, final Object lower, final Object upper) {
+        return Classes.getShortName(type) + '[' + lower + " … " + upper + ']';
+    }
+
+    /**
      * Returns a string with the same content than the given string, but in upper case and containing only the
      * filtered characters. If the given string already matches the criterion, then it is returned unchanged
      * without creation of any temporary object.
@@ -104,8 +154,6 @@ public final class Utilities extends Static {
      * @param  text     the text to filter.
      * @param  filter   the filter to apply.
      * @return the filtered text.
-     *
-     * @since 0.8
      */
     public static String toUpperCase(final String text, final Characters.Filter filter) {
         final int length = text.length();
@@ -143,8 +191,6 @@ public final class Utilities extends Static {
      * @param  classe      the class to format.
      * @param  properties  the (<var>key</var>=<var>value</var>) pairs.
      * @return a string representation of an instance of the given class having the given properties.
-     *
-     * @since 0.4
      */
     public static String toString(final Class<?> classe, final Object... properties) {
         final StringBuffer buffer = new StringBuffer(32).append(Classes.getShortName(classe)).append('[');
@@ -176,9 +222,7 @@ public final class Utilities extends Static {
      * @param precision  number of characters to keep before truncation, or -1 if no limit.
      * @param value      the text to format.
      */
-    public static void formatTo(final Formatter formatter, final int flags,
-            int width, int precision, String value)
-    {
+    public static void formatTo(final Formatter formatter, final int flags, int width, int precision, String value) {
         final String format;
         final Object[] args;
         boolean isUpperCase = (flags & FormattableFlags.UPPERCASE) != 0;
diff --git a/core/sis-utility/src/main/java/org/apache/sis/math/Line.java b/core/sis-utility/src/main/java/org/apache/sis/math/Line.java
index 6c0fae9..74f333b 100644
--- a/core/sis-utility/src/main/java/org/apache/sis/math/Line.java
+++ b/core/sis-utility/src/main/java/org/apache/sis/math/Line.java
@@ -21,6 +21,7 @@ import org.opengis.geometry.DirectPosition;
 import org.opengis.geometry.MismatchedDimensionException;
 import org.apache.sis.internal.util.DoubleDouble;
 import org.apache.sis.internal.util.Numerics;
+import org.apache.sis.internal.util.Strings;
 import org.apache.sis.util.resources.Errors;
 import org.apache.sis.util.ArgumentChecks;
 
@@ -294,8 +295,8 @@ public class Line implements Cloneable, Serializable {
         for (final DirectPosition p : points) {
             final int dimension = p.getDimension();
             if (dimension != DIMENSION) {
-                throw new MismatchedDimensionException(Errors.format(
-                        Errors.Keys.MismatchedDimension_3, "points[" + i + ']', DIMENSION, dimension));
+                throw new MismatchedDimensionException(Errors.format(Errors.Keys.MismatchedDimension_3,
+                            Strings.toIndexed("points", i), DIMENSION, dimension));
             }
             i++;
             final double x,y;
diff --git a/core/sis-utility/src/main/java/org/apache/sis/math/Plane.java b/core/sis-utility/src/main/java/org/apache/sis/math/Plane.java
index 9ca33ea..afdf696 100644
--- a/core/sis-utility/src/main/java/org/apache/sis/math/Plane.java
+++ b/core/sis-utility/src/main/java/org/apache/sis/math/Plane.java
@@ -22,6 +22,7 @@ import org.opengis.geometry.DirectPosition;
 import org.opengis.geometry.MismatchedDimensionException;
 import org.apache.sis.internal.util.DoubleDouble;
 import org.apache.sis.internal.util.Numerics;
+import org.apache.sis.internal.util.Strings;
 import org.apache.sis.util.resources.Errors;
 import org.apache.sis.util.ArgumentChecks;
 
@@ -386,8 +387,8 @@ public class Plane implements Cloneable, Serializable {
             for (final DirectPosition p : points) {
                 final int dimension = p.getDimension();
                 if (dimension != DIMENSION) {
-                    throw new MismatchedDimensionException(Errors.format(
-                            Errors.Keys.MismatchedDimension_3, "points[" + i + ']', DIMENSION, dimension));
+                    throw new MismatchedDimensionException(Errors.format(Errors.Keys.MismatchedDimension_3,
+                                Strings.toIndexed("points", i), DIMENSION, dimension));
                 }
                 i++;
                 final double x = p.getOrdinate(0); if (Double.isNaN(x)) continue;
@@ -431,7 +432,7 @@ public class Plane implements Cloneable, Serializable {
                 for (int x=0; x<nx; x++) {
                     final double z = vz.doubleValue(n);
                     if (Double.isNaN(z)) {
-                        throw new IllegalArgumentException(Errors.format(Errors.Keys.NotANumber_1, "z[" + n + ']'));
+                        throw new IllegalArgumentException(Errors.format(Errors.Keys.NotANumber_1, Strings.toIndexed("z", n)));
                     }
                     zx.setToProduct(z, x);
                     zy.setToProduct(z, y);
diff --git a/core/sis-utility/src/main/java/org/apache/sis/measure/Angle.java b/core/sis-utility/src/main/java/org/apache/sis/measure/Angle.java
index ec0ffca..ee7d04a 100644
--- a/core/sis-utility/src/main/java/org/apache/sis/measure/Angle.java
+++ b/core/sis-utility/src/main/java/org/apache/sis/measure/Angle.java
@@ -30,7 +30,7 @@ import org.opengis.referencing.cs.AxisDirection;
 import org.opengis.referencing.cs.CoordinateSystem;
 import org.opengis.referencing.cs.CoordinateSystemAxis;
 import org.opengis.referencing.crs.CoordinateReferenceSystem;
-import org.apache.sis.internal.util.Utilities;
+import org.apache.sis.internal.util.Strings;
 import org.apache.sis.util.resources.Errors;
 import org.apache.sis.util.Classes;
 
@@ -345,6 +345,6 @@ public class Angle implements Comparable<Angle>, Formattable, Serializable {
                 value = format.format(this, new StringBuffer(), null).toString();
             }
         }
-        Utilities.formatTo(formatter, flags, width, precision, value);
+        Strings.formatTo(formatter, flags, width, precision, value);
     }
 }
diff --git a/core/sis-utility/src/main/java/org/apache/sis/measure/AngleFormat.java b/core/sis-utility/src/main/java/org/apache/sis/measure/AngleFormat.java
index fbaaa78..7055d3b 100644
--- a/core/sis-utility/src/main/java/org/apache/sis/measure/AngleFormat.java
+++ b/core/sis-utility/src/main/java/org/apache/sis/measure/AngleFormat.java
@@ -30,6 +30,7 @@ import java.text.AttributedCharacterIterator;
 import org.apache.sis.util.Localized;
 import org.apache.sis.util.ArgumentChecks;
 import org.apache.sis.util.resources.Errors;
+import org.apache.sis.internal.util.Strings;
 import org.apache.sis.internal.util.LocalizedParseException;
 
 import static java.lang.Double.NaN;
@@ -1868,6 +1869,6 @@ BigBoss:    switch (skipSuffix(source, pos, DEGREES_FIELD)) {
      */
     @Override
     public String toString() {
-        return getClass().getSimpleName() + '[' + toPattern() + ']';
+        return Strings.bracket(getClass(), toPattern());
     }
 }
diff --git a/core/sis-utility/src/main/java/org/apache/sis/measure/Range.java b/core/sis-utility/src/main/java/org/apache/sis/measure/Range.java
index e34a287..bb653dd 100644
--- a/core/sis-utility/src/main/java/org/apache/sis/measure/Range.java
+++ b/core/sis-utility/src/main/java/org/apache/sis/measure/Range.java
@@ -22,7 +22,7 @@ import java.util.Formattable;
 import java.util.FormattableFlags;
 import java.io.Serializable;
 import javax.measure.Unit;
-import org.apache.sis.internal.util.Utilities;
+import org.apache.sis.internal.util.Strings;
 import org.apache.sis.util.collection.CheckedContainer;
 import org.apache.sis.util.ArgumentChecks;
 import org.apache.sis.util.Emptiable;
@@ -731,6 +731,6 @@ public class Range<E extends Comparable<? super E>> implements CheckedContainer<
             format.setAlternateForm((flags & FormattableFlags.ALTERNATE) != 0);
             value = format.format(this, new StringBuffer(), null).toString();
         }
-        Utilities.formatTo(formatter, flags, width, precision, value);
+        Strings.formatTo(formatter, flags, width, precision, value);
     }
 }
diff --git a/core/sis-utility/src/main/java/org/apache/sis/util/Characters.java b/core/sis-utility/src/main/java/org/apache/sis/util/Characters.java
index 17fb12c..f157899 100644
--- a/core/sis-utility/src/main/java/org/apache/sis/util/Characters.java
+++ b/core/sis-utility/src/main/java/org/apache/sis/util/Characters.java
@@ -17,6 +17,7 @@
 package org.apache.sis.util;
 
 import org.opengis.metadata.citation.Citation;  // For javadoc.
+import org.apache.sis.internal.util.Strings;
 import org.apache.sis.util.resources.Errors;
 
 
@@ -434,7 +435,7 @@ public final class Characters extends Static {
                 final int type = types[i];
                 if (type < 0 || type >= Long.SIZE) {
                     throw new IllegalArgumentException(Errors.format(
-                            Errors.Keys.IllegalArgumentValue_2, "types[" + i + ']', type));
+                            Errors.Keys.IllegalArgumentValue_2, Strings.toIndexed("types", i), type));
                 }
                 mask |= (1L << type);
             }
diff --git a/core/sis-utility/src/main/java/org/apache/sis/util/iso/AbstractInternationalString.java b/core/sis-utility/src/main/java/org/apache/sis/util/iso/AbstractInternationalString.java
index 014579b..ed08d7e 100644
--- a/core/sis-utility/src/main/java/org/apache/sis/util/iso/AbstractInternationalString.java
+++ b/core/sis-utility/src/main/java/org/apache/sis/util/iso/AbstractInternationalString.java
@@ -22,7 +22,7 @@ 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.internal.util.Strings;
 import org.apache.sis.util.CharSequences;
 
 
@@ -182,7 +182,7 @@ public abstract class AbstractInternationalString implements InternationalString
      */
     @Override
     public void formatTo(final Formatter formatter, final int flags, final int width, final int precision) {
-        Utilities.formatTo(formatter, flags, width, precision, toString(formatter.locale()));
+        Strings.formatTo(formatter, flags, width, precision, toString(formatter.locale()));
     }
 
     /**
diff --git a/core/sis-utility/src/main/java/org/apache/sis/util/resources/IndexedResourceBundle.java b/core/sis-utility/src/main/java/org/apache/sis/util/resources/IndexedResourceBundle.java
index b5cdd19..0bfebf3 100644
--- a/core/sis-utility/src/main/java/org/apache/sis/util/resources/IndexedResourceBundle.java
+++ b/core/sis-utility/src/main/java/org/apache/sis/util/resources/IndexedResourceBundle.java
@@ -43,6 +43,7 @@ import org.apache.sis.util.logging.Logging;
 import org.apache.sis.internal.system.Loggers;
 import org.apache.sis.internal.util.AutoMessageFormat;
 import org.apache.sis.internal.util.MetadataServices;
+import org.apache.sis.internal.util.Strings;
 import org.apache.sis.measure.RangeFormat;
 import org.apache.sis.measure.Range;
 
@@ -751,6 +752,6 @@ public class IndexedResourceBundle extends ResourceBundle implements Localized {
      */
     @Override
     public synchronized String toString() {
-        return getClass().getSimpleName() + '[' + getLocale() + ']';
+        return Strings.bracket(getClass(), getLocale());
     }
 }
diff --git a/core/sis-utility/src/test/java/org/apache/sis/internal/util/UtilitiesTest.java b/core/sis-utility/src/test/java/org/apache/sis/internal/util/UtilitiesTest.java
index b713072..7dbb01f 100644
--- a/core/sis-utility/src/test/java/org/apache/sis/internal/util/UtilitiesTest.java
+++ b/core/sis-utility/src/test/java/org/apache/sis/internal/util/UtilitiesTest.java
@@ -24,7 +24,7 @@ import static org.junit.Assert.*;
 
 
 /**
- * Tests the {@link Utilities} class.
+ * Tests the {@link Strings} class.
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @version 0.8
@@ -33,21 +33,21 @@ import static org.junit.Assert.*;
  */
 public final strictfp class UtilitiesTest extends TestCase {
     /**
-     * Tests the {@link Utilities#toString(Class, Object[])} method.
+     * Tests the {@link Strings#toString(Class, Object[])} method.
      */
     @Test
     public void testToString() {
-        assertEquals("Number[base=“decimal”, value=20]", Utilities.toString(Number.class, "base", "decimal", "value", 20));
+        assertEquals("Number[base=“decimal”, value=20]", Strings.toString(Number.class, "base", "decimal", "value", 20));
     }
 
     /**
-     * Tests the {@link Utilities#toUpperCase(String, Characters.Filter)} method.
+     * Tests the {@link Strings#toUpperCase(String, Characters.Filter)} method.
      */
     @Test
     public void testToUpperCase() {
         final String expected = "WGS84";
-        assertSame  (expected, Utilities.toUpperCase(expected, Characters.Filter.LETTERS_AND_DIGITS));
-        assertEquals(expected, Utilities.toUpperCase("WGS 84", Characters.Filter.LETTERS_AND_DIGITS));
-        assertEquals(expected, Utilities.toUpperCase("wgs 84", Characters.Filter.LETTERS_AND_DIGITS));
+        assertSame  (expected, Strings.toUpperCase(expected, Characters.Filter.LETTERS_AND_DIGITS));
+        assertEquals(expected, Strings.toUpperCase("WGS 84", Characters.Filter.LETTERS_AND_DIGITS));
+        assertEquals(expected, Strings.toUpperCase("wgs 84", Characters.Filter.LETTERS_AND_DIGITS));
     }
 }
diff --git a/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatReader.java b/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatReader.java
index 823f48a..13ab435 100644
--- a/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatReader.java
+++ b/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatReader.java
@@ -70,7 +70,7 @@ import org.apache.sis.internal.storage.MetadataBuilder;
 import org.apache.sis.internal.system.DefaultFactories;
 import org.apache.sis.internal.util.StandardDateFormat;
 import org.apache.sis.internal.util.Constants;
-import org.apache.sis.internal.util.Utilities;
+import org.apache.sis.internal.util.Strings;
 
 import static org.apache.sis.internal.util.CollectionsExt.singletonOrNull;
 
@@ -754,7 +754,7 @@ final class LandsatReader {
              * We ignore the "ELLIPSOID" attribute because it is implied by the datum.
              */
             case "DATUM": {
-                datum = CommonCRS.valueOf(Utilities.toUpperCase(value, Characters.Filter.LETTERS_AND_DIGITS));
+                datum = CommonCRS.valueOf(Strings.toUpperCase(value, Characters.Filter.LETTERS_AND_DIGITS));
                 break;
             }
             /*
diff --git a/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/CRSBuilder.java b/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/CRSBuilder.java
index f0e849d..86741d6 100644
--- a/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/CRSBuilder.java
+++ b/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/CRSBuilder.java
@@ -63,7 +63,7 @@ import org.apache.sis.internal.referencing.NilReferencingObject;
 import org.apache.sis.internal.referencing.ReferencingUtilities;
 import org.apache.sis.internal.referencing.ReferencingFactoryContainer;
 import org.apache.sis.internal.util.Constants;
-import org.apache.sis.internal.util.Utilities;
+import org.apache.sis.internal.util.Strings;
 import org.apache.sis.internal.util.Numerics;
 import org.apache.sis.math.Vector;
 import org.apache.sis.measure.Units;
@@ -996,7 +996,7 @@ final class CRSBuilder extends ReferencingFactoryContainer {
                 final Ellipsoid     ellipsoid = createEllipsoid(names, linearUnit);
                 final PrimeMeridian meridian  = createPrimeMeridian(names, angularUnit);
                 final GeodeticDatum datum     = getDatumFactory().createGeodeticDatum(properties(name), ellipsoid, meridian);
-                name = Utilities.toUpperCase(name, Characters.Filter.LETTERS_AND_DIGITS);
+                name = Strings.toUpperCase(name, Characters.Filter.LETTERS_AND_DIGITS);
                 lastName = datum.getName();
                 try {
                     final GeodeticDatum predefined = CommonCRS.valueOf(name).datum();
diff --git a/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/NetcdfStore.java b/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/NetcdfStore.java
index a704590..a893bb4 100644
--- a/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/NetcdfStore.java
+++ b/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/NetcdfStore.java
@@ -34,6 +34,7 @@ import org.apache.sis.storage.Aggregate;
 import org.apache.sis.internal.netcdf.Decoder;
 import org.apache.sis.internal.storage.URIDataStore;
 import org.apache.sis.internal.util.UnmodifiableArrayList;
+import org.apache.sis.internal.util.Strings;
 import org.apache.sis.setup.OptionKey;
 import org.apache.sis.storage.Resource;
 import org.apache.sis.storage.event.ChangeEvent;
@@ -256,6 +257,6 @@ public class NetcdfStore extends DataStore implements Aggregate {
      */
     @Override
     public String toString() {
-        return getClass().getSimpleName() + '[' + decoder + ']';
+        return Strings.bracket(getClass(), decoder);
     }
 }
diff --git a/storage/sis-storage/src/main/java/org/apache/sis/storage/DataStore.java b/storage/sis-storage/src/main/java/org/apache/sis/storage/DataStore.java
index 0889df2..7a23148 100644
--- a/storage/sis-storage/src/main/java/org/apache/sis/storage/DataStore.java
+++ b/storage/sis-storage/src/main/java/org/apache/sis/storage/DataStore.java
@@ -33,6 +33,7 @@ import org.apache.sis.util.logging.WarningListener;
 import org.apache.sis.util.logging.WarningListeners;
 import org.apache.sis.internal.storage.StoreUtilities;
 import org.apache.sis.internal.storage.Resources;
+import org.apache.sis.internal.util.Strings;
 import org.apache.sis.referencing.NamedIdentifier;
 
 
@@ -465,6 +466,6 @@ public abstract class DataStore implements Resource, Localized, AutoCloseable {
      */
     @Override
     public String toString() {
-        return getClass().getSimpleName() + '[' + getDisplayName() + ']';
+        return Strings.bracket(getClass(), getDisplayName());
     }
 }
diff --git a/storage/sis-storage/src/main/java/org/apache/sis/storage/ProbeResult.java b/storage/sis-storage/src/main/java/org/apache/sis/storage/ProbeResult.java
index c3e6e4b..87d6a7b 100644
--- a/storage/sis-storage/src/main/java/org/apache/sis/storage/ProbeResult.java
+++ b/storage/sis-storage/src/main/java/org/apache/sis/storage/ProbeResult.java
@@ -20,7 +20,7 @@ import java.util.Objects;
 import java.io.Serializable;
 import java.io.ObjectStreamException;
 import org.apache.sis.util.Version;
-import org.apache.sis.internal.util.Utilities;
+import org.apache.sis.internal.util.Strings;
 
 
 /**
@@ -251,7 +251,7 @@ public class ProbeResult implements Serializable {
      */
     @Override
     public String toString() {
-        return Utilities.toString(getClass(), "isSupported", isSupported, "mimeType", mimeType, "version", version);
+        return Strings.toString(getClass(), "isSupported", isSupported, "mimeType", mimeType, "version", version);
     }
 
     /**
@@ -314,7 +314,7 @@ public class ProbeResult implements Serializable {
          */
         @Override
         public String toString() {
-            return "ProbeResult[" + name + ']';
+            return Strings.bracket(ProbeResult.class, name);
         }
     }
 }
diff --git a/storage/sis-storage/src/main/java/org/apache/sis/storage/StorageConnector.java b/storage/sis-storage/src/main/java/org/apache/sis/storage/StorageConnector.java
index ca995e1..bd72e7c 100644
--- a/storage/sis-storage/src/main/java/org/apache/sis/storage/StorageConnector.java
+++ b/storage/sis-storage/src/main/java/org/apache/sis/storage/StorageConnector.java
@@ -56,7 +56,7 @@ import org.apache.sis.internal.storage.io.ChannelImageInputStream;
 import org.apache.sis.internal.storage.io.InputStreamAdapter;
 import org.apache.sis.internal.storage.io.RewindableLineReader;
 import org.apache.sis.internal.system.Modules;
-import org.apache.sis.internal.util.Utilities;
+import org.apache.sis.internal.util.Strings;
 import org.apache.sis.io.InvalidSeekException;
 import org.apache.sis.setup.OptionKey;
 
@@ -506,7 +506,7 @@ public class StorageConnector implements Serializable {
          */
         @Override
         public String toString() {
-            return Utilities.toString(getClass(),
+            return Strings.toString(getClass(),
                     "view",       Classes.getShortClassName(view),
                     "wrapperFor", (wrapperFor != null) ? Classes.getShortClassName(wrapperFor.view) : null,
                     "cascade",    cascade,
diff --git a/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/xml/stream/StaxDataStore.java b/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/xml/stream/StaxDataStore.java
index 4ec33e1..24f613c 100644
--- a/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/xml/stream/StaxDataStore.java
+++ b/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/xml/stream/StaxDataStore.java
@@ -44,7 +44,7 @@ import org.apache.sis.internal.storage.io.IOUtilities;
 import org.apache.sis.internal.storage.io.Markable;
 import org.apache.sis.internal.util.AbstractMap;
 import org.apache.sis.internal.util.Constants;
-import org.apache.sis.internal.util.Utilities;
+import org.apache.sis.internal.util.Strings;
 import org.apache.sis.io.wkt.WKTFormat;
 import org.apache.sis.io.InvalidSeekException;
 import org.apache.sis.storage.ConcurrentReadException;
@@ -365,7 +365,7 @@ public abstract class StaxDataStore extends URIDataStore {
          */
         @Override
         public String toString() {
-            return Utilities.toString(getClass(), "locale", locale, "timezone", timezone);
+            return Strings.toString(getClass(), "locale", locale, "timezone", timezone);
         }
     }
 


Mime
View raw message