パッケージ myproject.java.utils

クラス PropertiesUtils

java.lang.Object
myproject.java.utils.PropertiesUtils

public class PropertiesUtils extends Object
Propertiesの操作を提供します。 Copyright ycookjp https://github.com/ycookjp/
  • メソッドの詳細

    • loadResource

      public static Properties loadResource(String name) throws IOException
      プロパティファイルのクラスパスを指定して、Propertiesをロードします。

      クラスパスの通ったディレクトリに配置されているプロパティファイルのクラスパスを指定して プロパティファイルの内容を読み込んだPropertiesのインスタンスを返します。 クラスパスを指定したディレクトリの下の「test/properties/test.properteis」を読み込む場合は、 クラスパスの名前に「test/properties/test.properties」を指定します。

      パラメータ:
      name - クラスパスの名前
      戻り値:
      Propertiesを返します。nameにnullを指定した場合は、nullを返します。
      例外:
      IOException - Propertiesのロードに失敗した場合
    • replaceKeyword

      public static void replaceKeyword(Properties properties)
      プロパティの値の"{<keyword>}の部分を、システムプロパティ及びパラメータで指定された プロパティの<keyword>の値で置換します。
      パラメータ:
      properties - プロパティを指定します。nullを指定すると何もせずに復帰します。