|
JavaTM 2 Platform Standard Ed. 5.0 |
|||||||||
前のクラス 次のクラス | フレームあり フレームなし | |||||||||
概要: 入れ子 | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド |
java.lang.Objectjava.util.ResourceBundle
java.util.ListResourceBundle
public abstract class ListResourceBundle
ListResourceBundle
は、リストを便利かつ容易に使用できる、ロケールに対するリソースを管理する ResourceBundle
の abstract サブクラスです。リソースバンドル一般については、ResourceBundle
を参照してください。
サブクラスは、getContents
をオーバーライドし、配列を提供しなければいけません。この場合、配列の各項目はオブジェクトのペアです。各ペアの最初の要素は String
キーで、2 つ目の要素はこのキーに関連する値です。
次の例は、ベース名「MyResources」のリソースバンドルファミリの 2 つのメンバを示します。「MyResources」はバンドルファミリのデフォルトのメンバで、「MyResources_fr」はフランスのメンバです。これらのメンバは ListResourceBundle
に基づいています (関連例では、プロパティファイルに基づかないこのファミリにバンドルを追加する方法を示します)。この例のキーの形式は s1 などです。実際のキーはバンドルからオブジェクトを取り出すためにプログラムで使用するキーと同じであるかぎり、なんでもかまいません。キーには、大文字/小文字の区別があります。
public class MyResources extends ListResourceBundle { public Object[][] getContents() { return contents; } static final Object[][] contents = { // LOCALIZE THIS {"s1", "The disk \"{1}\" contains {0}."}, // MessageFormat pattern {"s2", "1"}, // location of {0} in pattern {"s3", "My Disk"}, // sample disk name {"s4", "no files"}, // first ChoiceFormat choice {"s5", "one file"}, // second ChoiceFormat choice {"s6", "{0,number} files"}, // third ChoiceFormat choice {"s7", "3 Mar 96"}, // sample date {"s8", new Dimension(1,5)} // real object, not just string // END OF MATERIAL TO LOCALIZE }; } public class MyResources_fr extends ListResourceBundle { public Object[][] getContents() { return contents; } static final Object[][] contents = { // LOCALIZE THIS {"s1", "Le disque \"{1}\" {0}."}, // MessageFormat pattern {"s2", "1"}, // location of {0} in pattern {"s3", "Mon disque"}, // sample disk name {"s4", "ne contient pas de fichiers"}, // first ChoiceFormat choice {"s5", "contient un fichier"}, // second ChoiceFormat choice {"s6", "contient {0,number} fichiers"}, // third ChoiceFormat choice {"s7", "3 mars 1996"}, // sample date {"s8", new Dimension(1,3)} // real object, not just string // END OF MATERIAL TO LOCALIZE }; }
ResourceBundle
,
PropertyResourceBundle
フィールドの概要 |
---|
クラス java.util.ResourceBundle から継承されたフィールド |
---|
parent |
コンストラクタの概要 | |
---|---|
ListResourceBundle()
唯一のコンストラクタです。 |
メソッドの概要 | |
---|---|
protected abstract Object[][] |
getContents()
クラスの説明を参照してください。 |
Enumeration<String> |
getKeys()
ResourceBundle.getKeys の実装です。 |
Object |
handleGetObject(String key)
このリソースバンドルから指定されたキーのオブジェクトを取得します。 |
クラス java.util.ResourceBundle から継承されたメソッド |
---|
getBundle, getBundle, getBundle, getLocale, getObject, getString, getStringArray, setParent |
クラス java.lang.Object から継承されたメソッド |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
コンストラクタの詳細 |
---|
public ListResourceBundle()
メソッドの詳細 |
---|
public final Object handleGetObject(String key)
ResourceBundle
の記述:
ResourceBundle
内の handleGetObject
key
- 望ましいオブジェクトのキー
public Enumeration<String> getKeys()
ResourceBundle
内の getKeys
protected abstract Object[][] getContents()
|
JavaTM 2 Platform Standard Ed. 5.0 |
|||||||||
前のクラス 次のクラス | フレームあり フレームなし | |||||||||
概要: 入れ子 | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド |
Copyright 2004 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms. Documentation Redistribution Policy も参照してください。