/* * Copyright 2001-2004 The Apache Software Foundation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.axis.i18n; import java.text.MessageFormat; import java.util.Locale; import java.util.MissingResourceException; import java.util.ResourceBundle; /** * Accept parameters for ProjectResourceBundle, * but defer object instantiation (and therefore * resource bundle loading) until required. * * @author Richard A. Sitze (rsitze@us.ibm.com) * @author Karl Moss (kmoss@macromedia.com) * @author Glen Daniels (gdaniels@apache.org) */ public class MessageBundle { private boolean loaded = false; private ProjectResourceBundle _resourceBundle = null; private final String projectName; private final String packageName; private final String resourceName; private final Locale locale; private final ClassLoader classLoader; private final ResourceBundle parent; public final ProjectResourceBundle getResourceBundle() { if (!loaded) { _resourceBundle = ProjectResourceBundle.getBundle(projectName, packageName, resourceName, locale, classLoader, parent); loaded = true; } return _resourceBundle; } /** * Construct a new ExtendMessages */ public MessageBundle(String projectName, String packageName, String resourceName, Locale locale, ClassLoader classLoader, ResourceBundle parent) throws MissingResourceException { this.projectName = projectName; this.packageName = packageName; this.resourceName = resourceName; this.locale = locale; this.classLoader = classLoader; this.parent = parent; } /** * Gets a string message from the resource bundle for the given key * @param key The resource key * @return The message */ public String getMessage(String key) throws MissingResourceException { return getMessage(key, (String[]) null); } /** *
Gets a string message from the resource bundle for the given key. The * message may contain variables that will be substituted with the given * arguments. Variables have the format:
*Gets a string message from the resource bundle for the given key. The * message may contain variables that will be substituted with the given * arguments. Variables have the format:
*Gets a string message from the resource bundle for the given key. The * message may contain variables that will be substituted with the given * arguments. Variables have the format:
*Gets a string message from the resource bundle for the given key. The * message may contain variables that will be substituted with the given * arguments. Variables have the format:
*Gets a string message from the resource bundle for the given key. The * message may contain variables that will be substituted with the given * arguments. Variables have the format:
*Gets a string message from the resource bundle for the given key. The * message may contain variables that will be substituted with the given * arguments. Variables have the format:
*