2025 年 3 月 27 日より、AOSP のビルドとコントリビューションには aosp-main
ではなく android-latest-release
を使用することをおすすめします。詳細については、AOSP の変更をご覧ください。
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
TfInternalOptionsFetcher
public
class
TfInternalOptionsFetcher
extends Object
java.lang.Object
|
↳ |
com.android.tradefed.util.TfInternalOptionsFetcher
|
クラスが res ファイルから変数値を静的に読み込むことができるユーティリティ クラス。
リソース ファイルは key=value 形式にする必要があります。キーは、取得する必要がある変数に関連付けられます。1 つのリソース ファイルには複数の行を含めることができ、各行は 1 つの変数に関連付けられます。
プリミティブ型を指定するには、1 行に 1 つの key=value ペアを使用する必要があります。次に例を示します。
- my-integer-key=5
- my-string-key=myStringValue
コレクションを指定する場合は、複数の値をカンマ(,)で区切って使用できます。例:
- my-string-list-key=stringOne,stringTwo,stringThree
- my-int-list-key=1,2,3,4,5
マップを指定するには、複数の mapKey\=mapValue ペアをカンマ(,)で区切って使用します。次に例を示します。
- my-map-key=mapKey1\=mapVal1,mapKey2\=mapVal2
概要
パブリック メソッド |
static
void
|
fetchOption(Class<?> classObj)
指定された Class の宣言されたすべてのフィールドの値を、指定されたリソース ファイルから取得します。
|
static
void
|
setResourcePath(String path)
値を取得するリソース ファイルのパスを設定します。
|
パブリック コンストラクタ
TfInternalOptionsFetcher
public TfInternalOptionsFetcher ()
パブリック メソッド
fetchOption
public static void fetchOption (Class<?> classObj)
指定された Class
の宣言されたすべてのフィールドの値を、指定されたリソース ファイルから取得します。リソース ファイルが設定されていない場合は、デフォルトのリソース ファイルが使用されます。
パラメータ |
classObj |
Class : フィールドに値を設定する必要のあるクラス Object 。 |
setResourcePath
public static void setResourcePath (String path)
値を取得するリソース ファイルのパスを設定します。
このページのコンテンツやコードサンプルは、コンテンツ ライセンスに記載のライセンスに従います。Java および OpenJDK は Oracle および関連会社の商標または登録商標です。
最終更新日 2025-07-27 UTC。
[[["わかりやすい","easyToUnderstand","thumb-up"],["問題の解決に役立った","solvedMyProblem","thumb-up"],["その他","otherUp","thumb-up"]],[["必要な情報がない","missingTheInformationINeed","thumb-down"],["複雑すぎる / 手順が多すぎる","tooComplicatedTooManySteps","thumb-down"],["最新ではない","outOfDate","thumb-down"],["翻訳に関する問題","translationIssue","thumb-down"],["サンプル / コードに問題がある","samplesCodeIssue","thumb-down"],["その他","otherDown","thumb-down"]],["最終更新日 2025-07-27 UTC。"],[],[],null,["# TfInternalOptionsFetcher\n========================\n\n\n`\npublic\n\n\nclass\nTfInternalOptionsFetcher\n`\n\n\n`\n\nextends Object\n\n\n`\n\n`\n\n\n`\n\n|---|----------------------------------------------------|\n| java.lang.Object ||\n| ↳ | com.android.tradefed.util.TfInternalOptionsFetcher |\n\n\u003cbr /\u003e\n\n*** ** * ** ***\n\nA utility class that allows classes to load a variables value statically from a res file.\n\nThe resource file should be in a key=value format, where the key is associated with the\nvariable that needs to be retrieved. A single resource file can contain multiple lines, where\neach line is associated with one variable.\n\nTo specify any primitive types, a single key=value pair should be used in a line. e.g.:\n\n1. my-integer-key=5\n2. my-string-key=myStringValue\n\nTo specify any collections, multiple values can be used, separated by a comma(,). e.g.:\n\n1. my-string-list-key=stringOne,stringTwo,stringThree\n2. my-int-list-key=1,2,3,4,5\n\nTo specify a map, multiple mapKey\\\\=mapValue pair can be used, separated by a comma(,). e.g.:\n\n1. my-map-key=mapKey1\\\\=mapVal1,mapKey2\\\\=mapVal2\n\n\u003cbr /\u003e\n\nSummary\n-------\n\n| ### Public constructors ||\n|-------------------------------------------------------------------------------------------------------------------------------------------------------------|---|\n| ` `[TfInternalOptionsFetcher](../../../../../../reference/tradefed/com/android/tradefed/util/TfInternalOptionsFetcher.html#TfInternalOptionsFetcher())`() ` |\n\n| ### Public methods ||\n|----------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ` static void` | ` `[fetchOption](../../../../../../reference/tradefed/com/android/tradefed/util/TfInternalOptionsFetcher.html#fetchOption(java.lang.Class\u003c?\u003e))`(Class\u003c?\u003e classObj) ` Fetches the values for all declared fields of the given [Class](../../../../../../reference/tradefed/java/lang/Class.html) from the specified resource file. |\n| ` static void` | ` `[setResourcePath](../../../../../../reference/tradefed/com/android/tradefed/util/TfInternalOptionsFetcher.html#setResourcePath(java.lang.String))`(String path) ` Set the path of the resource file where the value will be retrieved from. |\n\nPublic constructors\n-------------------\n\n### TfInternalOptionsFetcher\n\n```\npublic TfInternalOptionsFetcher ()\n```\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\nPublic methods\n--------------\n\n### fetchOption\n\n```\npublic static void fetchOption (Class\u003c?\u003e classObj)\n```\n\nFetches the values for all declared fields of the given [Class](../../../../../../reference/tradefed/java/lang/Class.html) from the specified\nresource file. If a resource file is not set, a default resource file will be used.\n\n\u003cbr /\u003e\n\n| Parameters ||\n|------------|----------------------------------------------------------------------------------------------------------------------------------|\n| `classObj` | `Class`: the class [Object](../../../../../../reference/tradefed/java/lang/Object.html) whose fields should be populated. \u003cbr /\u003e |\n\n### setResourcePath\n\n```\npublic static void setResourcePath (String path)\n```\n\nSet the path of the resource file where the value will be retrieved from.\n\n\u003cbr /\u003e\n\n| Parameters ||\n|--------|-----------------|\n| `path` | `String` \u003cbr /\u003e |"]]