Options
All
  • Public
  • Public/Protected
  • All
Menu

Class ConditionalPut<K, V>

ConditionalPut is an EntryProcessor that performs an update operation for an entry that satisfies the specified condition.

While the ConditionalPut processing could be implemented via direct key-based NamedMap operations, it is more efficient and enforces concurrency control without explicit locking.

Obviously, using more specific, fine-tuned filters (rather than ones based on the IdentityExtractor) may provide additional flexibility and efficiency allowing the put operation to be performed conditionally on values of specific attributes (or even calculations) instead of the entire object.

Type parameters

  • K = any

  • V = any

Hierarchy

Implements

Index

Constructors

Properties

Methods

Constructors

constructor

  • Construct a ConditionalPut that updates an entry with a new value if and only if the filter applied to the entry evaluates to true. The result of the invocation does not return any result.

    Parameters

    • filter: Filter

      the filter to evaluate an entry

    • value: V

      a value to update an entry with

    • Optional returnValue: boolean

      specifies whether or not the processor should return the current value in case it has not been updated

    Returns ConditionalPut

Properties

@class

@class: string

Protected Readonly filter

filter: Filter

The underlying filter.

Protected return

return: boolean = true

Specifies whether or not a return value is required.

Protected Readonly value

value: V

Specifies the new value to update an entry with.

Methods

andThen

returnCurrent

  • returnCurrent(returnCurrent?: boolean): this
  • If called, it will cause the processor to return the current value in case it has not been updated.

    Parameters

    • Default value returnCurrent: boolean = true

      specifies whether or not the processor should return the current value in case it has not been updated

    Returns this

when

  • Returns a ConditionalProcessor comprised of this processor and the provided filter.

    The specified entry processor gets invoked if and only if the filter applied to the entry evaluates to true; otherwise the result of the invocation will return null.

    Parameters

    Returns EntryProcessor<K, V, V>