All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.opengis.cite.iso19136.ErrorMessage Maven / Gradle / Ivy

Go to download

Checks GML application schemas or data sets for conformance to ISO 19136:2007.

There is a newer version: 3.2.1-r18
Show newest version
package org.opengis.cite.iso19136;

import java.text.MessageFormat;
import java.util.MissingResourceException;
import java.util.ResourceBundle;

/**
 * Utility class for retrieving and formatting localized error messages that
 * describe failed assertions.
 */
public class ErrorMessage {

    private static final String BASE_NAME = "org.opengis.cite.iso19136.MessageBundle";
    private static ResourceBundle msgResources = ResourceBundle
            .getBundle(BASE_NAME);

    /**
     * Produces a formatted error message using the supplied substitution
     * arguments and the current locale. The arguments should reflect the order
     * of the placeholders in the message template.
     * 
     * @param msgKey
     *            The key identifying the message template; it should be a
     *            member of {@code ErrorMessageKeys}.
     * @param args
     *            An array of arguments to be formatted and substituted in the
     *            content of the message.
     * @return A String containing the message content. If no message is found
     *         for the given key, a {@link MissingResourceException} is thrown.
     */
    public static String format(String msgKey, Object... args) {
        return MessageFormat.format(msgResources.getString(msgKey), args);
    }

    /**
     * Retrieves a simple message according to the current locale.
     * 
     * @param msgKey
     *            The key identifying the message; it should be a member of
     *            {@code ErrorMessageKeys}.
     * @return A String containing the message content. If no message is found
     *         for the given key, a {@link MissingResourceException} is thrown.
     */
    public static String get(String msgKey) {
        return msgResources.getString(msgKey);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy