Controls the behavior when an option is specified multiple times. Note that this enum assumes
that the values to be set are not ERROR(/Collection)
s or ERROR(/Map)
s.
Enum values |
OptionUpdateRule |
FIRST
once an option is set, subsequent attempts to update it should be ignored.
|
OptionUpdateRule |
GREATEST
for Comparable options, keep the one that compares as the greatest.
|
OptionUpdateRule |
IMMUTABLE
throw a ConfigurationException if this option is set more than once.
|
OptionUpdateRule |
LAST
if an option is set multiple times, ignore all but the last value.
|
OptionUpdateRule |
LEAST
for Comparable options, keep the one that compares as the least.
|
Enum values
FIRST
public static final OptionUpdateRule FIRST
once an option is set, subsequent attempts to update it should be ignored.
LAST
public static final OptionUpdateRule LAST
if an option is set multiple times, ignore all but the last value.
Public methods
shouldUpdate
public boolean shouldUpdate (String optionName,
Object optionSource,
Field field,
Object update)
Takes the current value and the update value, and returns whether the value should be
updated. Assumes that update
is never null.
Parameters |
optionName |
String |
optionSource |
Object |
field |
Field |
update |
Object |
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 2023-07-19 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 2023-07-19 UTC."],[],[],null,["# OptionUpdateRule\n================\n\n\n`\npublic\n\nfinal\n\nenum\nOptionUpdateRule\n`\n\n\n`\n\n\n`\n\n`\n\nextends Enum\u003c`[OptionUpdateRule](../../../../../../reference/tradefed/com/android/tradefed/config/OptionUpdateRule.html)`\u003e\n\n\n`\n\n`\n\n\n`\n\n|---|---|----------------------------------------------|\n| java.lang.Object |||\n| ↳ | java.lang.Enum\\\u003c[com.android.tradefed.config.OptionUpdateRule](../../../../../../reference/tradefed/com/android/tradefed/config/OptionUpdateRule.html)\\\u003e ||\n| | ↳ | com.android.tradefed.config.OptionUpdateRule |\n\n\u003cbr /\u003e\n\n*** ** * ** ***\n\nControls the behavior when an option is specified multiple times. Note that this enum assumes\nthat the values to be set are not [ERROR(/Collection)](../../../../../../)s or [ERROR(/Map)](../../../../../../)s.\n\nSummary\n-------\n\n| ### Enum values ||\n|------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [OptionUpdateRule](../../../../../../reference/tradefed/com/android/tradefed/config/OptionUpdateRule.html) | `FIRST` once an option is set, subsequent attempts to update it should be ignored. |\n| [OptionUpdateRule](../../../../../../reference/tradefed/com/android/tradefed/config/OptionUpdateRule.html) | `GREATEST` for [Comparable](../../../../../../reference/tradefed/java/lang/Comparable.html) options, keep the one that compares as the greatest. |\n| [OptionUpdateRule](../../../../../../reference/tradefed/com/android/tradefed/config/OptionUpdateRule.html) | `IMMUTABLE` throw a [ConfigurationException](../../../../../../reference/tradefed/com/android/tradefed/config/ConfigurationException.html) if this option is set more than once. |\n| [OptionUpdateRule](../../../../../../reference/tradefed/com/android/tradefed/config/OptionUpdateRule.html) | `LAST` if an option is set multiple times, ignore all but the last value. |\n| [OptionUpdateRule](../../../../../../reference/tradefed/com/android/tradefed/config/OptionUpdateRule.html) | `LEAST` for [Comparable](../../../../../../reference/tradefed/java/lang/Comparable.html) options, keep the one that compares as the least. |\n\n| ### Public methods ||\n|------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ` boolean` | ` `[shouldUpdate](../../../../../../reference/tradefed/com/android/tradefed/config/OptionUpdateRule.html#shouldUpdate(java.lang.String,%20java.lang.Object,%20Field,%20java.lang.Object))`(String optionName, Object optionSource, Field field, Object update) ` Takes the current value and the update value, and returns whether the value should be updated. |\n| ` static `[OptionUpdateRule](../../../../../../reference/tradefed/com/android/tradefed/config/OptionUpdateRule.html) | ` `[valueOf](../../../../../../reference/tradefed/com/android/tradefed/config/OptionUpdateRule.html#valueOf(java.lang.String))`(String name) ` |\n| ` static final `[OptionUpdateRule[]](../../../../../../reference/tradefed/com/android/tradefed/config/OptionUpdateRule.html) | ` `[values](../../../../../../reference/tradefed/com/android/tradefed/config/OptionUpdateRule.html#values())`() ` |\n\nEnum values\n-----------\n\n### FIRST\n\n```\npublic static final OptionUpdateRule FIRST\n```\n\nonce an option is set, subsequent attempts to update it should be ignored.\n\n\u003cbr /\u003e\n\n### GREATEST\n\n```\npublic static final OptionUpdateRule GREATEST\n```\n\nfor [Comparable](../../../../../../reference/tradefed/java/lang/Comparable.html) options, keep the one that compares as the greatest.\n\n\u003cbr /\u003e\n\n### IMMUTABLE\n\n```\npublic static final OptionUpdateRule IMMUTABLE\n```\n\nthrow a [ConfigurationException](../../../../../../reference/tradefed/com/android/tradefed/config/ConfigurationException.html) if this option is set more than once.\n\n\u003cbr /\u003e\n\n### LAST\n\n```\npublic static final OptionUpdateRule LAST\n```\n\nif an option is set multiple times, ignore all but the last value.\n\n\u003cbr /\u003e\n\n### LEAST\n\n```\npublic static final OptionUpdateRule LEAST\n```\n\nfor [Comparable](../../../../../../reference/tradefed/java/lang/Comparable.html) options, keep the one that compares as the least.\n\n\u003cbr /\u003e\n\nPublic methods\n--------------\n\n### shouldUpdate\n\n```\npublic boolean shouldUpdate (String optionName, \n Object optionSource, \n Field field, \n Object update)\n```\n\nTakes the current value and the update value, and returns whether the value should be\nupdated. Assumes that `update` is never null.\n\n\u003cbr /\u003e\n\n| Parameters ||\n|----------------|-----------------|\n| `optionName` | `String` \u003cbr /\u003e |\n| `optionSource` | `Object` \u003cbr /\u003e |\n| `field` | `Field` \u003cbr /\u003e |\n| `update` | `Object` \u003cbr /\u003e |\n\n| Returns ||\n|-----------|--------|\n| `boolean` | \u003cbr /\u003e |\n\n| Throws ||\n|------------------------------------------------------------------------------------------------------------------------|---|\n| [ConfigurationException](../../../../../../reference/tradefed/com/android/tradefed/config/ConfigurationException.html) | |\n\n### valueOf\n\n```\npublic static OptionUpdateRule valueOf (String name)\n```\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Parameters ||\n|--------|-----------------|\n| `name` | `String` \u003cbr /\u003e |\n\n| Returns ||\n|------------------------------------------------------------------------------------------------------------|--------|\n| [OptionUpdateRule](../../../../../../reference/tradefed/com/android/tradefed/config/OptionUpdateRule.html) | \u003cbr /\u003e |\n\n### values\n\n```\npublic static final OptionUpdateRule[] values ()\n```\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ||\n|--------------------------------------------------------------------------------------------------------------|--------|\n| [OptionUpdateRule[]](../../../../../../reference/tradefed/com/android/tradefed/config/OptionUpdateRule.html) | \u003cbr /\u003e |"]]