Starting March 27, 2025, we recommend using android-latest-release
instead of aosp-main
to build and contribute to AOSP. For more information, see Changes to AOSP.
Stay organized with collections
Save and categorize content based on your preferences.
TfInternalOptionsFetcher
public
class
TfInternalOptionsFetcher
extends Object
java.lang.Object
|
↳ |
com.android.tradefed.util.TfInternalOptionsFetcher
|
A utility class that allows classes to load a variables value statically from a res file.
The resource file should be in a key=value format, where the key is associated with the
variable that needs to be retrieved. A single resource file can contain multiple lines, where
each line is associated with one variable.
To specify any primitive types, a single key=value pair should be used in a line. e.g.:
- my-integer-key=5
- my-string-key=myStringValue
To specify any collections, multiple values can be used, separated by a comma(,). e.g.:
- my-string-list-key=stringOne,stringTwo,stringThree
- my-int-list-key=1,2,3,4,5
To specify a map, multiple mapKey\=mapValue pair can be used, separated by a comma(,). e.g.:
- my-map-key=mapKey1\=mapVal1,mapKey2\=mapVal2
Summary
Public methods |
static
void
|
fetchOption(Class<?> classObj)
Fetches the values for all declared fields of the given Class from the specified
resource file.
|
static
void
|
setResourcePath(String path)
Set the path of the resource file where the value will be retrieved from.
|
Public constructors
TfInternalOptionsFetcher
public TfInternalOptionsFetcher ()
Public methods
fetchOption
public static void fetchOption (Class<?> classObj)
Fetches the values for all declared fields of the given Class
from the specified
resource file. If a resource file is not set, a default resource file will be used.
Parameters |
classObj |
Class : the class Object whose fields should be populated. |
setResourcePath
public static void setResourcePath (String path)
Set the path of the resource file where the value will be retrieved from.
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-01-30 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-01-30 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 |"]]