public class OptionKey<T> extends Object
OptionValues object.| Modifier and Type | Method and Description |
|---|---|
protected void |
afterValueUpdate()
Notifies this object after a value associated with this key was set or updated.
|
protected boolean |
checkDescriptorExists()
Checks that a descriptor exists for this key after triggering loading of descriptors.
|
T |
getDefaultValue()
The initial value specified in source code.
|
OptionDescriptor |
getDescriptor()
Returns the descriptor for this option, if it has been set by
OptionKey.setDescriptor(OptionDescriptor). |
String |
getName()
Gets the name of this option.
|
T |
getValue(OptionValues values)
Gets the value of this option in
values. |
T |
getValueOrDefault(org.graalvm.collections.UnmodifiableEconomicMap<OptionKey<?>,Object> values)
Gets the value of this option in
values if it is present, otherwise
OptionKey.getDefaultValue(). |
boolean |
hasBeenSet(OptionValues values)
Returns true if the option has been set in any way.
|
protected void |
onValueUpdate(org.graalvm.collections.EconomicMap<OptionKey<?>,Object> values,
T oldValue,
T newValue)
Notifies this object when a value associated with this key is set or updated in
values. |
void |
putIfAbsent(org.graalvm.collections.EconomicMap<OptionKey<?>,Object> values,
Object v)
Sets the value of this option in a given map if it doesn't already have a value.
|
void |
setDescriptor(OptionDescriptor descriptor)
Sets the descriptor for this option.
|
String |
toString() |
void |
update(org.graalvm.collections.EconomicMap<OptionKey<?>,Object> values,
Object v)
Sets the value of this option in a given map.
|
public OptionKey(T defaultValue)
public final void setDescriptor(OptionDescriptor descriptor)
public final OptionDescriptor getDescriptor()
OptionKey.setDescriptor(OptionDescriptor).protected boolean checkDescriptorExists()
public final String getName()
Object.toString().public final T getDefaultValue()
public boolean hasBeenSet(OptionValues values)
public T getValue(OptionValues values)
values.public T getValueOrDefault(org.graalvm.collections.UnmodifiableEconomicMap<OptionKey<?>,Object> values)
values if it is present, otherwise
OptionKey.getDefaultValue().public void update(org.graalvm.collections.EconomicMap<OptionKey<?>,Object> values, Object v)
OptionKey.onValueUpdate(EconomicMap, Object, Object) method is called once the value is set.values - map of option valuesv - the value to set for this key in valuespublic void putIfAbsent(org.graalvm.collections.EconomicMap<OptionKey<?>,Object> values, Object v)
OptionKey.onValueUpdate(EconomicMap, Object, Object) method is called once the value is set.values - map of option valuesv - the value to set for this key in valuesprotected void onValueUpdate(org.graalvm.collections.EconomicMap<OptionKey<?>,Object> values, T oldValue, T newValue)
values.values - oldValue - newValue - protected void afterValueUpdate()