diff options
author | The Android Open Source Project <initial-contribution@android.com> | 2009-03-03 18:28:45 -0800 |
---|---|---|
committer | The Android Open Source Project <initial-contribution@android.com> | 2009-03-03 18:28:45 -0800 |
commit | d83a98f4ce9cfa908f5c54bbd70f03eec07e7553 (patch) | |
tree | 4b825dc642cb6eb9a060e54bf8d69288fbee4904 /awt/org/apache/harmony/beans | |
parent | 076357b8567458d4b6dfdcf839ef751634cd2bfb (diff) | |
download | frameworks_base-d83a98f4ce9cfa908f5c54bbd70f03eec07e7553.zip frameworks_base-d83a98f4ce9cfa908f5c54bbd70f03eec07e7553.tar.gz frameworks_base-d83a98f4ce9cfa908f5c54bbd70f03eec07e7553.tar.bz2 |
auto import from //depot/cupcake/@135843
Diffstat (limited to 'awt/org/apache/harmony/beans')
-rw-r--r-- | awt/org/apache/harmony/beans/internal/nls/Messages.java | 151 | ||||
-rw-r--r-- | awt/org/apache/harmony/beans/internal/nls/MsgHelp.java | 86 |
2 files changed, 0 insertions, 237 deletions
diff --git a/awt/org/apache/harmony/beans/internal/nls/Messages.java b/awt/org/apache/harmony/beans/internal/nls/Messages.java deleted file mode 100644 index 51e8168..0000000 --- a/awt/org/apache/harmony/beans/internal/nls/Messages.java +++ /dev/null @@ -1,151 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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. - */ - -/* - * THE FILE HAS BEEN AUTOGENERATED BY MSGTOOL TOOL. - * All changes made to this file manually will be overwritten - * if this tool runs again. Better make changes in the template file. - */ - -package org.apache.harmony.beans.internal.nls; - - -import java.security.AccessController; -import java.security.PrivilegedAction; -import java.util.Locale; -import java.util.MissingResourceException; -import java.util.ResourceBundle; - -// BEGIN android-deleted -/* - * For Android, this module is a separate library and not part of the - * boot classpath, so its resources won't be found on the boot classpath - * as is assumed by MsgHelp.getString(). We instead use a local MsgHelp - * which bottoms out in a call to the useful part of its lower-level - * namesake. - */ -//import org.apache.harmony.kernel.vm.VM; -//import org.apache.harmony.luni.util.MsgHelp; -// END android-deleted - -/** - * This class retrieves strings from a resource bundle and returns them, - * formatting them with MessageFormat when required. - * <p> - * It is used by the system classes to provide national language support, by - * looking up messages in the <code> - * org.apache.harmony.beans.internal.nls.messages - * </code> - * resource bundle. Note that if this file is not available, or an invalid key - * is looked up, or resource bundle support is not available, the key itself - * will be returned as the associated message. This means that the <em>KEY</em> - * should a reasonable human-readable (english) string. - * - */ -public class Messages { - - // BEGIN android-deleted - // private static final String sResource = - // "org.apache.harmony.beans.internal.nls.messages"; //$NON-NLS-1$ - // END android-deleted - - /** - * Retrieves a message which has no arguments. - * - * @param msg - * String the key to look up. - * @return String the message for that key in the system message bundle. - */ - static public String getString(String msg) { - // BEGIN android-changed - return MsgHelp.getString(msg); - // END android-changed - } - - /** - * Retrieves a message which takes 1 argument. - * - * @param msg - * String the key to look up. - * @param arg - * Object the object to insert in the formatted output. - * @return String the message for that key in the system message bundle. - */ - static public String getString(String msg, Object arg) { - return getString(msg, new Object[] { arg }); - } - - /** - * Retrieves a message which takes 1 integer argument. - * - * @param msg - * String the key to look up. - * @param arg - * int the integer to insert in the formatted output. - * @return String the message for that key in the system message bundle. - */ - static public String getString(String msg, int arg) { - return getString(msg, new Object[] { Integer.toString(arg) }); - } - - /** - * Retrieves a message which takes 1 character argument. - * - * @param msg - * String the key to look up. - * @param arg - * char the character to insert in the formatted output. - * @return String the message for that key in the system message bundle. - */ - static public String getString(String msg, char arg) { - return getString(msg, new Object[] { String.valueOf(arg) }); - } - - /** - * Retrieves a message which takes 2 arguments. - * - * @param msg - * String the key to look up. - * @param arg1 - * Object an object to insert in the formatted output. - * @param arg2 - * Object another object to insert in the formatted output. - * @return String the message for that key in the system message bundle. - */ - static public String getString(String msg, Object arg1, Object arg2) { - return getString(msg, new Object[] { arg1, arg2 }); - } - - /** - * Retrieves a message which takes several arguments. - * - * @param msg - * String the key to look up. - * @param args - * Object[] the objects to insert in the formatted output. - * @return String the message for that key in the system message bundle. - */ - static public String getString(String msg, Object[] args) { - // BEGIN android-changed - return MsgHelp.getString(msg, args); - // END android-changed - } - - // BEGIN android-note - // Duplicate code was dropped in favor of using MsgHelp. - // END android-note -} diff --git a/awt/org/apache/harmony/beans/internal/nls/MsgHelp.java b/awt/org/apache/harmony/beans/internal/nls/MsgHelp.java deleted file mode 100644 index 68faabf..0000000 --- a/awt/org/apache/harmony/beans/internal/nls/MsgHelp.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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. - */ - -/* - * This implementation is based on the class of the same name in - * org.apache.harmony.luni.util. - */ - -package org.apache.harmony.beans.internal.nls; - -import java.io.IOException; -import java.io.InputStream; -import java.util.logging.Logger; -import java.util.Locale; -import java.util.PropertyResourceBundle; -import java.util.ResourceBundle; -import java.util.MissingResourceException; - -/** - * This class contains helper methods for loading resource bundles and - * formatting external message strings. - */ -public final class MsgHelp { - /** name of the resource for this class */ - private static final String RESOURCE_NAME = - "/org/apache/harmony/beans/internal/nls/messages.properties"; - - /** the resource bundle for this class */ - private static final ResourceBundle THE_BUNDLE; - - static { - ResourceBundle rb = null; - - try { - InputStream in = MsgHelp.class.getResourceAsStream( - RESOURCE_NAME); - rb = new PropertyResourceBundle(in); - } catch (IOException ex) { - Logger.global.warning("Couldn't read resource bundle: " + - ex); - } catch (RuntimeException ex) { - // Shouldn't happen, but deal at least somewhat gracefully. - Logger.global.warning("Couldn't find resource bundle: " + - ex); - } - - THE_BUNDLE = rb; - } - - public static String getString(String msg) { - if (THE_BUNDLE == null) { - return msg; - } - try { - return THE_BUNDLE.getString(msg); - } catch (MissingResourceException e) { - return "Missing message: " + msg; - } - } - - static public String getString(String msg, Object[] args) { - String format = msg; - if (THE_BUNDLE != null) { - try { - format = THE_BUNDLE.getString(msg); - } catch (MissingResourceException e) { - } - } - - return org.apache.harmony.luni.util.MsgHelp.format(format, args); - } -} |