全パッケージ  クラス階層  このパッケージ  前項目  次項目  インデックス

クラス java.util.ListResourceBundle

java.lang.Object
   |
   +----java.util.ResourceBundle
           |
           +----java.util.ListResourceBundle

public abstract class ListResourceBundle
extends ResourceBundle
ListResourceBundleは、ロケールに対する資源を管理する ResourceBundleの abstractサブクラスです。リソースバンドル一般については、ResourceBundleを参照してください。

サブクラスは、getContentsをオーバーライドし、配列を提供しなければなりません。この場合、配列の各アイテムはオブジェクトのペアです。各ペアの最初の要素は Stringキー、2つめはこのキーに対応する値です。

次の例で、キーの形式は "s1"..です。実際のキーは、バンドルからオブジェクトを取り出すためにプログラムが使用するキーと同じである限り何でもかまいません。キーには大文字/小文字の区別があります。バンドルファミリのデフォルト版は MyResource、フランス版は MyResource_frです。

 //====================
 class MyResource extends ListResourceBundle {
 	public Object[][] getContents() {
 		return contents;
 	}
 	static final Object[][] contents = {
 	// LOCALIZE THIS
 		{"s1", "3"},		// starting value in choice field
 		{"s2", "MyDisk"},	// starting value in string field
 		{"s3", "3 Mar 96"},	// starting value in date field
 		{"s4", "The disk '{1}' contained {0} on {2}."},	// initial pattern
 		{"s5", "0"},		// first choice number
 		{"s6", "no files"},	// first choice value
 		{"s7", "1"},		// second choice number
 		{"s8", "one file"},	// second choice value
 		{"s9", "2"},		// third choice number
 		{"s10", "{0}|3 files"},	// third choice value
 		{"s11", "format threw an exception: {0}"},	// generic exception message
 		{"s12", "ERROR"},	// what to show in field in case of error
 		{"s14", "Result"},	// label for formatted stuff
 		{"s13", "Dialog"},	// standard font
 		{"s15", "Pattern"},	// label for standard pattern
 		{"s16", new Dimension(1,5)}	// real object, not just string
 	// END OF MATERIAL TO LOCALIZE
 	};
 }
 //====================
 class MyResource_fr  extends ListResourceBundle {
 	public Object[][] getContents() {
 		return contents;
}
 	static final Object[][] contents = {
 	// LOCALIZE THIS
 		{"s1", "3"},		// starting value in choice field
 		{"s2", "MonDisk"},	// starting value in string field
 		{"s3", "3 Mar 96"},	// starting value in date field
 		{"s4", "Le disk '{1}' a {0} a {2}."},	// initial pattern
 		{"s5", "0"},		// first choice number
 		{"s6", "pas de files"},	// first choice value
 		{"s7", "1"},		// second choice number
 		{"s8", "une file"},	// second choice value
 		{"s9", "2"},		// third choice number
 		{"s10", "{0}|3 files"},	// third choice value
 		{"s11", "Le format a jete une exception: {0}"},	// generic exception message
 		{"s12", "ERROR"},	// what to show in field in case of error
 		{"s14", "Resulte"},	// label for formatted stuff
 		{"s13", "Dialogue"},	// standard font
 		{"s15", "Pattern"},	// label for standard pattern
 		{"s16", new Dimension(1,3)}	// real object, not just string
 	// END OF MATERIAL TO LOCALIZE
 	};
 }
 

参照:
ResourceBundle, PropertyResourceBundle

Constructor Index

 o ListResourceBundle()

Method Index

 o getContents()
クラスの説明を参照のこと。
 o getKeys()
ResourceBundle.getKeysの実装である。
 o handleGetObject(String)
ResourceBundleをオーバーライドする。セマンティックスは変わらない。

Constructors

 o ListResourceBundle
  public ListResourceBundle()

Methods

 o handleGetObject
  public final Object handleGetObject(String key)
ResourceBundleをオーバーライドします。セマンティックスは変わりません。

オーバーライド:
クラス ResourceBundlehandleGetObject
 o getKeys
  public Enumeration getKeys()
ResourceBundle.getKeysの実装です。

オーバーライド:
クラス ResourceBundlegetKeys
 o getContents
  protected abstract Object[][] getContents()
クラスの説明を参照してください。


全パッケージ  クラス階層  このパッケージ  前項目  次項目  インデックス