Interface ICustomNumberField

    • Method Detail

      • getOrDefault

        Number getOrDefault​(Number defaultValue)
        Gets the value of the custom field or the provided defaultValue if no value has been set.

        Examples:

        String branchOffice = ivy.task.customFields().stringField("branchOffice").getOrDefault("Luzern");
        Specified by:
        getOrDefault in interface ICustomField<Number>
        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:
        ICustomField.getOrNull(), ICustomField.get()
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • compareAndSet

        boolean compareAndSet​(Number expectedValue,
                              Number newValue)

        Sets the given newValue if the current value of the field is equal to the expectedValue 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 as ICustomField.delete(). Expecting a null value means that the newValue is only set if currently no value is set.

        Examples:

        boolean successful = ivy.task.customFields().stringField("salesState").compareAndSet("FirstContact", "OfferSent");
        Specified by:
        compareAndSet in interface ICustomField<Number>
        Parameters:
        expectedValue - the expected value
        newValue - the new value
        Returns:
        true if the new value was set otherwise false
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.