This is an automated email from the ASF dual-hosted git repository. desruisseaux pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/sis.git
commit a07b4869f901860874118e546f8b50dcea647ed8 Author: Martin Desruisseaux <martin.desruisse...@geomatys.com> AuthorDate: Sat Nov 19 16:43:47 2022 +0100 Make `MetadataStandard` class more similar to the version on other branches, for making merges easier. --- .../main/java/org/apache/sis/metadata/MetadataStandard.java | 7 +++---- .../java/org/apache/sis/metadata/StandardImplementation.java | 10 ++++------ 2 files changed, 7 insertions(+), 10 deletions(-) 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 7f3e53e8ff..e2d1f6d626 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 @@ -152,12 +152,11 @@ public class MetadataStandard implements Serializable { */ public static final MetadataStandard ISO_19123; static { - final String[] prefix = {"Default", "Abstract"}; final String[] acronyms = {"CoordinateSystem", "CS", "CoordinateReferenceSystem", "CRS"}; - ISO_19115 = new StandardImplementation("ISO 19115", "org.opengis.metadata.", "org.apache.sis.metadata.iso.", prefix, null, (MetadataStandard[]) null); - ISO_19157 = new StandardImplementation("ISO 19157", "org.opengis.metadata.quality.", "org.apache.sis.metadata.iso.quality.", prefix, null, ISO_19115); - ISO_19111 = new StandardImplementation("ISO 19111", "org.opengis.referencing.", "org.apache.sis.referencing.", prefix, acronyms, ISO_19157, ISO_19115); + ISO_19115 = new StandardImplementation("ISO 19115", "org.opengis.metadata.", "org.apache.sis.metadata.iso.", null, (MetadataStandard[]) null); + ISO_19157 = new StandardImplementation("ISO 19157", "org.opengis.metadata.quality.", "org.apache.sis.metadata.iso.quality.", null, ISO_19115); + ISO_19111 = new StandardImplementation("ISO 19111", "org.opengis.referencing.", "org.apache.sis.referencing.", acronyms, ISO_19157, ISO_19115); ISO_19123 = new MetadataStandard ("ISO 19123", "org.opengis.coverage.", ISO_19111); INSTANCES = new MetadataStandard[] { ISO_19157, // Need to be declared before ISO 19115. diff --git a/core/sis-metadata/src/main/java/org/apache/sis/metadata/StandardImplementation.java b/core/sis-metadata/src/main/java/org/apache/sis/metadata/StandardImplementation.java index ecef84d0d9..214101680e 100644 --- a/core/sis-metadata/src/main/java/org/apache/sis/metadata/StandardImplementation.java +++ b/core/sis-metadata/src/main/java/org/apache/sis/metadata/StandardImplementation.java @@ -49,9 +49,9 @@ final class StandardImplementation extends MetadataStandard { /** * The prefixes that implementation classes may have. - * The most common prefixes should be first, since the prefixes will be tried in that order. + * The most common prefixes should be first, because the prefixes will be tried in that order. */ - private final String[] prefix; + private static final String[] IMPL_PREFIXES = {"Default", "Abstract"}; /** * The acronyms that implementation classes may have, or {@code null} if none. If non-null, @@ -81,16 +81,14 @@ final class StandardImplementation extends MetadataStandard { * @param citation the title of the standard. * @param interfacePackage the root package for metadata interfaces, with a trailing {@code '.'}. * @param implementationPackage the root package for metadata implementations. with a trailing {@code '.'}. - * @param prefix the prefix of implementation class. This array is not cloned. * @param acronyms an array of (full text, acronyms) pairs. This array is not cloned. * @param dependencies the dependencies to other metadata standards, or {@code null} if none. */ StandardImplementation(final String citation, final String interfacePackage, final String implementationPackage, - final String[] prefix, final String[] acronyms, final MetadataStandard... dependencies) + final String[] acronyms, final MetadataStandard... dependencies) { super(citation, interfacePackage, dependencies); this.implementationPackage = implementationPackage; - this.prefix = prefix; this.acronyms = acronyms; this.implementations = new IdentityHashMap<>(); } @@ -149,7 +147,7 @@ final class StandardImplementation extends MetadataStandard { */ final int prefixPosition = buffer.lastIndexOf(".") + 1; int length = 0; - for (final String p : prefix) { + for (final String p : IMPL_PREFIXES) { classname = buffer.replace(prefixPosition, prefixPosition + length, p).toString(); try { candidate = Class.forName(classname);