Interface ICustomStringField
- All Superinterfaces:
ICustomField<String>
- See Also:
- API:
- This is a public API.
-
Method Summary
Modifier and TypeMethodDescriptionboolean
compareAndSet
(String expectedValue, String newValue) Sets the givennewValue
if the current value of the field is equal to theexpectedValue
otherwise the value is not set.getOrDefault
(String defaultValue) Gets the value of the custom field or the provideddefaultValue
if no value has been set.Gets the value of the custom field or null/default.void
Sets the value of the field.
-
Method Details
-
getOrNull
String getOrNull()Gets the value of the custom field or null/default.Examples:
String branchOffice = ivy.task.customFields().stringField("branchOffice").getOrNull();
- Specified by:
getOrNull
in interfaceICustomField<String>
- Returns:
- value or null
- See Also:
- API:
- This public API is available in Java.
-
getOrDefault
Gets the value of the custom field or the provideddefaultValue
if no value has been set.Examples:
String branchOffice = ivy.task.customFields().stringField("branchOffice").getOrDefault("Luzern");
- Specified by:
getOrDefault
in interfaceICustomField<String>
- Parameters:
defaultValue
- the value that is returned if no value has been set on the field- Returns:
- value or defaultValue if not value has been set
- See Also:
- API:
- This public API is available in Java.
-
set
Sets the value of the field.
Set of
null
has the same effect asICustomField.delete()
.Examples:
ivy.task.customFields().stringField("branchOffice").set("Zug");
- Specified by:
set
in interfaceICustomField<String>
- Parameters:
value
- new value of the field- See Also:
- API:
- This public API is available in Java.
-
compareAndSet
Sets the given
newValue
if the current value of the field is equal to theexpectedValue
otherwise the value is not set.This is an atomic operation. During the read of the current value and the set of the new value parallel transactions are blocked and cannot change the value in the meantime.
Setting of a
null
has the same effect asICustomField.delete()
. Expecting anull
value means that thenewValue
is only set if currently no value is set.Examples:
boolean successful = ivy.task.customFields().stringField("salesState").compareAndSet("FirstContact", "OfferSent");
- Specified by:
compareAndSet
in interfaceICustomField<String>
- Parameters:
expectedValue
- the expected valuenewValue
- the new value- Returns:
- true if the new value was set otherwise false
- API:
- This public API is available in Java.
-