⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rb.java

📁 Java有关XML编程需要用到axis 的源代码 把里面bin下的包导入相应的Java工程 进行使用
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
    protected Properties merge(Properties p1, Properties p2)    {        if ((p1 == null) &&            (p2 == null)) {            return null;        }        else if (p1 == null) {            return p2;        }        else if (p2 == null) {            return p1;        }        // Now merge. p1 takes precedence        Enumeration enumeration = p2.keys();        while (enumeration.hasMoreElements()) {            String key = (String) enumeration.nextElement();            if (p1.getProperty(key) == null) {                p1.put(key, p2.getProperty(key));            }        }        return p1;    }    /**      * Get the underlying properties      */    public Properties getProperties()    {        return resourceProperties;    }    // STATIC ACCESSORS    /**      * Get a message from resource.properties from the package of the given object.      * @param caller The calling object, used to get the package name and class loader      * @param key The resource key      * @return The formatted message      */    public static String getString(Object caller, String key)        throws MissingResourceException    {        return getMessage(caller, BASE_NAME, null, key, null);    }    /**      * Get a message from resource.properties from the package of the given object.      * @param caller The calling object, used to get the package name and class loader      * @param key The resource key      * @param arg0 The argument to place in variable {0}      * @return The formatted message      */    public static String getString(Object caller, String key, Object arg0)        throws MissingResourceException    {        Object[] o = new Object[1];        o[0] = arg0;        return getMessage(caller, BASE_NAME, null, key, o);    }    /**      * Get a message from resource.properties from the package of the given object.      * @param caller The calling object, used to get the package name and class loader      * @param key The resource key      * @param arg0 The argument to place in variable {0}      * @param arg1 The argument to place in variable {1}      * @return The formatted message      */    public static String getString(Object caller, String key, Object arg0, Object arg1)        throws MissingResourceException    {        Object[] o = new Object[2];        o[0] = arg0;        o[1] = arg1;        return getMessage(caller, BASE_NAME, null, key, o);    }    /**      * Get a message from resource.properties from the package of the given object.      * @param caller The calling object, used to get the package name and class loader      * @param key The resource key      * @param arg0 The argument to place in variable {0}      * @param arg1 The argument to place in variable {1}      * @param arg2 The argument to place in variable {2}      * @return The formatted message      */    public static String getString(Object caller, String key, Object arg0, Object arg1, Object arg2)        throws MissingResourceException    {        Object[] o = new Object[3];        o[0] = arg0;        o[1] = arg1;        o[2] = arg2;        return getMessage(caller, BASE_NAME, null, key, o);    }    /**      * Get a message from resource.properties from the package of the given object.      * @param caller The calling object, used to get the package name and class loader      * @param key The resource key      * @param arg0 The argument to place in variable {0}      * @param arg1 The argument to place in variable {1}      * @param arg2 The argument to place in variable {2}      * @param arg3 The argument to place in variable {3}      * @return The formatted message      */    public static String getString(Object caller, String key, Object arg0, Object arg1, Object arg2, Object arg3)        throws MissingResourceException    {        Object[] o = new Object[4];        o[0] = arg0;        o[1] = arg1;        o[2] = arg2;        o[3] = arg3;        return getMessage(caller, BASE_NAME, null, key, o);    }    /**      * Get a message from resource.properties from the package of the given object.      * @param caller The calling object, used to get the package name and class loader      * @param key The resource key      * @param arg0 The argument to place in variable {0}      * @param arg1 The argument to place in variable {1}      * @param arg2 The argument to place in variable {2}      * @param arg3 The argument to place in variable {3}      * @param arg4 The argument to place in variable {4}      * @return The formatted message      */    public static String getString(Object caller, String key, Object arg0, Object arg1, Object arg2, Object arg3, Object arg4)        throws MissingResourceException    {        Object[] o = new Object[5];        o[0] = arg0;        o[1] = arg1;        o[2] = arg2;        o[3] = arg3;        o[4] = arg4;        return getMessage(caller, BASE_NAME, null, key, o);    }    /**      * Get a message from resource.properties from the package of the given object.      * @param caller The calling object, used to get the package name and class loader      * @param key The resource key      * @param array An array of objects to place in corresponding variables      * @return The formatted message      */    public static String getString(Object caller, String key, Object[] args)        throws MissingResourceException    {        return getMessage(caller, BASE_NAME, null, key, args);    }    /**      * Get a message from resource.properties from the package of the given object.      * @param caller The calling object, used to get the package name and class loader      * @param locale The locale      * @param key The resource key      * @return The formatted message      */    public static String getString(Object caller, Locale locale, String key)        throws MissingResourceException    {        return getMessage(caller, BASE_NAME, locale, key, null);    }    /**      * Get a message from resource.properties from the package of the given object.      * @param caller The calling object, used to get the package name and class loader      * @param locale The locale      * @param key The resource key      * @param arg0 The argument to place in variable {0}      * @return The formatted message      */    public static String getString(Object caller, Locale locale, String key, Object arg0)        throws MissingResourceException    {        Object[] o = new Object[1];        o[0] = arg0;        return getMessage(caller, BASE_NAME, locale, key, o);    }    /**      * Get a message from resource.properties from the package of the given object.      * @param caller The calling object, used to get the package name and class loader      * @param locale The locale      * @param key The resource key      * @param arg0 The argument to place in variable {0}      * @param arg1 The argument to place in variable {1}      * @return The formatted message      */    public static String getString(Object caller, Locale locale, String key, Object arg0, Object arg1)        throws MissingResourceException    {        Object[] o = new Object[2];        o[0] = arg0;        o[1] = arg1;        return getMessage(caller, BASE_NAME, locale, key, o);    }    /**      * Get a message from resource.properties from the package of the given object.      * @param caller The calling object, used to get the package name and class loader      * @param locale The locale      * @param key The resource key      * @param arg0 The argument to place in variable {0}      * @param arg1 The argument to place in variable {1}      * @param arg2 The argument to place in variable {2}      * @return The formatted message      */    public static String getString(Object caller, Locale locale, String key, Object arg0, Object arg1, Object arg2)        throws MissingResourceException    {        Object[] o = new Object[3];        o[0] = arg0;        o[1] = arg1;        o[2] = arg2;        return getMessage(caller, BASE_NAME, locale, key, o);    }    /**      * Get a message from resource.properties from the package of the given object.      * @param caller The calling object, used to get the package name and class loader      * @param locale The locale      * @param key The resource key      * @param arg0 The argument to place in variable {0}      * @param arg1 The argument to place in variable {1}      * @param arg2 The argument to place in variable {2}      * @param arg3 The argument to place in variable {3}      * @return The formatted message      */    public static String getString(Object caller, Locale locale, String key, Object arg0, Object arg1, Object arg2, Object arg3)        throws MissingResourceException    {        Object[] o = new Object[4];        o[0] = arg0;        o[1] = arg1;        o[2] = arg2;        o[3] = arg3;        return getMessage(caller, BASE_NAME, locale, key, o);    }    /**      * Get a message from resource.properties from the package of the given object.      * @param caller The calling object, used to get the package name and class loader      * @param locale The locale      * @param key The resource key      * @param arg0 The argument to place in variable {0}      * @param arg1 The argument to place in variable {1}      * @param arg2 The argument to place in variable {2}      * @param arg3 The argument to place in variable {3}      * @return The formatted message      */    public static String getString(Object caller, Locale locale, String key, Object arg0, Object arg1, Object arg2, Object arg3, Object arg4)        throws MissingResourceException    {        Object[] o = new Object[5];        o[0] = arg0;        o[1] = arg1;        o[2] = arg2;        o[3] = arg3;        o[4] = arg4;        return getMessage(caller, BASE_NAME, locale, key, o);    }    /**      * Get a message from resource.properties from the package of the given object.      * @param caller The calling object, used to get the package name and class loader      * @param locale The locale      * @param key The resource key      * @param array An array of objects to place in corresponding variables      * @return The formatted message      */    public static String getString(Object caller, Locale locale, String key, Object[] args)        throws MissingResourceException    {        return getMessage(caller, BASE_NAME, locale, key, args);    }    // Workhorse that does the resource loading and key lookup    public static String getMessage(Object caller, String basename, Locale locale, String key,                                       Object[] args)        throws MissingResourceException    {        String msg = null;        MissingResourceException firstEx = null;        String fullName = null;        Class curClass = null;        boolean didNull = false;                if (caller != null) {            if(caller instanceof Class)                curClass = (Class) caller;            else                curClass = caller.getClass();        }        while (msg == null) {            // Get the full name of the resource            if (curClass != null) {                // Create the full basename                String pkgName = curClass.getName();                int pos = pkgName.lastIndexOf(".");                if (pos > 0) {                    fullName = pkgName.substring(0, pos + 1).replace('.', '/') + basename;                }                else {                    fullName = basename;                }            }            else {                fullName = basename;            }            try {                RB rb = new RB(caller, fullName, locale);                msg = rb.getString(key, args);            }            catch (MissingResourceException ex) {                if (curClass == null) {                    throw ex;                }                // Save the first exception                if (firstEx == null) {                    firstEx = ex;                }                // Get the superclass                curClass = curClass.getSuperclass();                if (curClass == null) {                    if (didNull)                        throw firstEx;                    didNull = true;                    caller = null;                } else {                    String cname = curClass.getName();                    if (cname.startsWith("java.") ||                        cname.startsWith("javax.")) {                        if (didNull)                            throw firstEx;                        didNull = true;                        caller = null;                        curClass = null;                    }                }            }        }        return msg;    }    /**      * Clears the internal cache      */    public static void clearCache()    {        propertyCache.clear();    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -