| //------------------------------------------------------------------------------ |
| // Copyright (c) 2005, 2006 IBM Corporation and others. |
| // All rights reserved. This program and the accompanying materials |
| // are made available under the terms of the Eclipse Public License v1.0 |
| // which accompanies this distribution, and is available at |
| // http://www.eclipse.org/legal/epl-v10.html |
| // |
| // Contributors: |
| // IBM Corporation - initial implementation |
| //------------------------------------------------------------------------------ |
| package org.eclipse.epf.persistence.util; |
| |
| import java.util.ResourceBundle; |
| |
| import org.eclipse.epf.common.utils.I18nUtil; |
| |
| |
| /** |
| * The Library Persistence message resource bundle accessor class. |
| * |
| * @author Phong Nguyen Le |
| * @since 1.0 |
| */ |
| public class PersistenceResources { |
| |
| private final static ResourceBundle RESOURCE_BUNDLE = ResourceBundle |
| .getBundle(PersistenceResources.class.getPackage().getName() |
| + ".Resources"); //$NON-NLS-1$ |
| |
| /** |
| * Private constructor to prevent ths class from being instantiated. |
| */ |
| private PersistenceResources() { |
| } |
| |
| /** |
| * Returns the localized string associated with a resource key. |
| * |
| * @param key |
| * A resource key. |
| * @return A localized string. |
| */ |
| public static String getString(String key) { |
| return I18nUtil.getString(RESOURCE_BUNDLE, key); |
| } |
| |
| /** |
| * Returns the localized string associated with a resource key and formatted |
| * with a given string. |
| * |
| * @param key |
| * A resource key. |
| * @param data |
| * An object. |
| * @return A formatted localized string. |
| */ |
| public static String formatString(String key, Object data) { |
| return I18nUtil.formatString(RESOURCE_BUNDLE, key, data); |
| } |
| |
| /** |
| * Returns the localized string associated with a resource key and formatted |
| * with a given string. |
| * |
| * @param key |
| * A resource key. |
| * @param data1 |
| * An object. |
| * @param data2 |
| * An object. |
| * @return A formatted localized string. |
| */ |
| public static String formatString(String key, Object data1, Object data2) { |
| return I18nUtil.formatString(RESOURCE_BUNDLE, key, data1, data2); |
| } |
| |
| /** |
| * Returns the localized string associated with a resource key and formatted |
| * with a given string. |
| * |
| * @param key |
| * A resource key. |
| * @param data |
| * An array of objects. |
| * @return A formatted localized string. |
| */ |
| public static String formatString(String key, Object[] data) { |
| return I18nUtil.formatString(RESOURCE_BUNDLE, key, data); |
| } |
| |
| } |