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.:

  1. my-integer-key=5
  2. my-string-key=myStringValue

To specify any collections, multiple values can be used, separated by a comma(,). e.g.:

  1. my-string-list-key=stringOne,stringTwo,stringThree
  2. 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.:

  1. my-map-key=mapKey1\=mapVal1,mapKey2\=mapVal2

Summary

Public constructors

TfInternalOptionsFetcher()

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.

Parameters
path String