org.opengis.cite.iso19136.ErrorMessage Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ets-gml32 Show documentation
Show all versions of ets-gml32 Show documentation
Checks GML application schemas or data sets for conformance to ISO 19136:2007.
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);
}
}