Java Tools Class (1) resourcebundle

Source: Internet
Author: User

Package Com.infofuse.util;import Java.util.missingresourceexception;import Java.util.resourcebundle;public class    Propertiesutils {private static final String propertiesfile = "parameter";    Default binding resource private static resourcebundle resources = NULL; /** * Gets the specified property value * @param property name * @return */public static string Getpropertiesvalue (String Propert        Y) {String val = "";            try {if (resources = = null) {initresources ();        val = resources.getstring (property);    } catch (Exception e) {//Ignore} return Val; /** * Gets the specified key value according to the configuration file * @param propertiesfile Properties File * @param property name * @return */Public St        Atic string Getpropertiesvalue (String Propertiesfile, string property) {        String val = "";        ResourceBundle resources1 = null; try {resources1 = Resourcebundle.getbundle (Propertiesfile);        val = resources1.getstring (property);    } catch (MissingResourceException e) {//Ignore} return Val; }/** * Initialize config file */private static void Initresources () {try {resources = ResourceBundle.        Getbundle (Propertiesfile);        } catch (MissingResourceException e) {throw new RuntimeException (e); }    }}

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Java Tools Class (1) resourcebundle

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.