OptionSetter
public
class
OptionSetter
extends Object
java.lang.Object | |
↳ | com.android.tradefed.config.OptionSetter |
Populates Option
fields.
ConfigurationException
is thrown.
File option fields are supported by simply wrapping the string argument in a File object without
testing for the existence of the file.
Parameterized Collection fields such as List<File> and Set<String> are supported as
long as the parameter type is otherwise supported by the option setter. The collection field
should be initialized with an appropriate collection instance.
All fields will be processed, including public, protected, default (package) access, private and
inherited fields.
ported from dalvik.runner.OptionParser
See also:
Summary
Nested classes | |
---|---|
class |
OptionSetter.OptionFieldsForName
Container for the list of option fields with given name. |
Constants | |
---|---|
char |
NAMESPACE_SEPARATOR
|
Public constructors | |
---|---|
OptionSetter(
Constructs a new OptionParser for setting the @Option fields of 'optionSources'. |
|
OptionSetter(Object... optionSources)
Constructs a new OptionParser for setting the @Option fields of 'optionSources'. |
Public methods | |
---|---|
static
Object
|
getFieldValue(Field field, Object optionObject)
Return the given |
IKeyStoreClient
|
getKeyStore()
|
static
|
getOptionFieldsForClass(Class<?> optionClass)
Gets a list of all |
String
|
getTypeForOption(String name)
Returns a string describing the type of the field with given name. |
boolean
|
isBooleanOption(String name)
|
boolean
|
isMapOption(String name)
|
void
|
setKeyStore(IKeyStoreClient keyStore)
|
|
setOptionValue(String optionName, String valueText)
Sets the value for a non-map option. |
|
setOptionValue(String optionName, String keyText, String valueText)
Sets the value for an option. |
final
|
validateRemoteFilePath(DynamicRemoteFileResolver resolver)
Runs through all the |
Protected methods | |
---|---|
|
getUnsetMandatoryOptions()
Returns the names of all of the |
Constants
NAMESPACE_SEPARATOR
public static final char NAMESPACE_SEPARATOR
Constant Value: 58 (0x0000003a)
Public constructors
OptionSetter
public OptionSetter (optionSources)
Constructs a new OptionParser for setting the @Option fields of 'optionSources'.
Parameters | |
---|---|
optionSources |
|
Throws | |
---|---|
|
com.android.tradefed.config.ConfigurationException |
ConfigurationException |
OptionSetter
public OptionSetter (Object... optionSources)
Constructs a new OptionParser for setting the @Option fields of 'optionSources'.
Parameters | |
---|---|
optionSources |
Object |
Throws | |
---|---|
|
com.android.tradefed.config.ConfigurationException |
ConfigurationException |
Public methods
getFieldValue
public static Object getFieldValue (Field field, Object optionObject)
Return the given ERROR(/Field)
's value, handling any exceptions.
Parameters | |
---|---|
field |
Field : the ERROR(/Field) |
optionObject |
Object : the Object to get field's value from. |
Returns | |
---|---|
Object |
the field's value as a Object , or null |
getOptionFieldsForClass
public staticgetOptionFieldsForClass (Class<?> optionClass)
Gets a list of all Option
fields (both declared and inherited) for given class.
Parameters | |
---|---|
optionClass |
Class : the Class to search |
Returns | |
---|---|
|
a ERROR(/Collection) of fields annotated with Option |
getTypeForOption
public String getTypeForOption (String name)
Returns a string describing the type of the field with given name.
Parameters | |
---|---|
name |
String : the Option field name |
Returns | |
---|---|
String |
a String describing the field's type |
Throws | |
---|---|
ConfigurationException |
if field could not be found |
isBooleanOption
public boolean isBooleanOption (String name)
Parameters | |
---|---|
name |
String |
Returns | |
---|---|
boolean |
Throws | |
---|---|
ConfigurationException |
isMapOption
public boolean isMapOption (String name)
Parameters | |
---|---|
name |
String |
Returns | |
---|---|
boolean |
Throws | |
---|---|
ConfigurationException |
setOptionValue
publicsetOptionValue (String optionName, String valueText)
Sets the value for a non-map option.
Parameters | |
---|---|
optionName |
String : the name of Option to set |
valueText |
String : the value |
Returns | |
---|---|
|
A list of ERROR(FieldDef/com.android.tradefed.config.OptionSetter.FieldDef FieldDef) s corresponding to each object field that was modified. |
Throws | |
---|---|
ConfigurationException |
if Option cannot be found or valueText is wrong type |
setOptionValue
publicsetOptionValue (String optionName, String keyText, String valueText)
Sets the value for an option.
Parameters | |
---|---|
optionName |
String : the name of Option to set |
keyText |
String : the key for Map options, or null. |
valueText |
String : the value |
Returns | |
---|---|
|
A list of ERROR(FieldDef/com.android.tradefed.config.OptionSetter.FieldDef FieldDef) s corresponding to each object field that was modified. |
Throws | |
---|---|
ConfigurationException |
if Option cannot be found or valueText is wrong type |
validateRemoteFilePath
public finalvalidateRemoteFilePath (DynamicRemoteFileResolver resolver)
Runs through all the ERROR(/File)
option type and check if their path should be resolved.
Parameters | |
---|---|
resolver |
DynamicRemoteFileResolver : The DynamicRemoteFileResolver to use to resolve the files. |
Returns | |
---|---|
|
The list of ERROR(/File) that was resolved that way. |
Throws | |
---|---|
|
com.android.tradefed.build.BuildRetrievalError |
BuildRetrievalError |
Protected methods
getUnsetMandatoryOptions
protectedgetUnsetMandatoryOptions ()
Returns the names of all of the Option
s that are marked as mandatory
but
remain unset.
Returns | |
---|---|
|
A ERROR(/Collection) of String s containing the (unqualified) names of unset
mandatory options. |
Throws | |
---|---|
ConfigurationException |
if a field to be checked is inaccessible |
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 2024-10-08 UTC.