Package 

Class PatchingKt

  • All Implemented Interfaces:

    
    public final class PatchingKt
    
                        
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Constructor Summary

      Constructors 
      Constructor Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      final static <T extends Any> Unit use(PatchOp<T> $self, Function1<T, Unit> block) Allows using a patch operation by passing an appropriate value to the given block function.
      final static <T extends Any> Unit use(UpdateOp<T> $self, Function1<T, Unit> block) Allows using a patch update operation by passing an appropriate value to the given block function.
      final static <T extends Any> T getOrDefaultNullifyingDelete(PatchOp<T> $self, Function0<T> current) Retrieves a value depending on the patch operation where delete is mapped to null and none is mapped to the value returned by given the current function.
      final static <T extends Any> T getOrElse(PatchOp<T> $self, Function1<Boolean, Void> block) Retrieves a value for set operations and calls the block function for delete and none operations.
      final static <T extends Any, R extends Any> PatchOp<R> map(PatchOp<T> $self, Function1<T, R> transform) Transforms the value for set operations by calling the provided transform function and creating a new set operation; all other patch operations (delete and none) are returned as is.
      final static <T extends Any, R extends Any> UpdateOp<R> map(UpdateOp<T> $self, Function1<T, R> transform) Transforms the value for set operations by calling the provided transform function and creating a new set operation; none operations are returned as is.
      final static <T extends Any> T getOrDefault(UpdateOp<T> $self, Function0<T> current) Retrieves a value depending on the patch operation where none is mapped to the value returned by given the current function.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

    • Method Detail

      • use

         final static <T extends Any> Unit use(PatchOp<T> $self, Function1<T, Unit> block)

        Allows using a patch operation by passing an appropriate value to the given block function.

        • set - If the patch is a set the block will be called with the new value.

        • delete - If the patch is a delete the block will be called with null.

        • none - If the patch is a none the block will not be called.

        Parameters:
        block - Usage function to be called (or not) based on the patch operation.
      • use

         final static <T extends Any> Unit use(UpdateOp<T> $self, Function1<T, Unit> block)

        Allows using a patch update operation by passing an appropriate value to the given block function.

        • set - If the patch is a set the block will be called with the new value.

        • none - If the patch is a none the block will not be called.

        Parameters:
        block - Usage function to be called (or not) based on the patch operation.
      • getOrDefaultNullifyingDelete

         final static <T extends Any> T getOrDefaultNullifyingDelete(PatchOp<T> $self, Function0<T> current)

        Retrieves a value depending on the patch operation where delete is mapped to null and none is mapped to the value returned by given the current function.

        • set - If the patch is a set, the new value will be returned.

        • delete - If the patch is a delete, null will be returned.

        • none - If the patch is none, the value returned by current will be returned.

        Parameters:
        current - Value to be returned when the patch operation is none.
      • getOrElse

         final static <T extends Any> T getOrElse(PatchOp<T> $self, Function1<Boolean, Void> block)

        Retrieves a value for set operations and calls the block function for delete and none operations.

        • set - If the patch is a set, the new value will be returned.

        • delete - If the patch is a delete, block is called with the deleted parameter set to true.

        • none - If the patch is none, block is called with the deleted parameter set to false.

        The provided block is function that returns Nothing and therefore must throw an exception or some other equivalent operation.

        Parameters:
        block - Function to be called for delete or none operations.
      • map

         final static <T extends Any, R extends Any> PatchOp<R> map(PatchOp<T> $self, Function1<T, R> transform)

        Transforms the value for set operations by calling the provided transform function and creating a new set operation; all other patch operations (delete and none) are returned as is.

        Parameters:
        transform - Function to be called for set operations to transform the value.
      • map

         final static <T extends Any, R extends Any> UpdateOp<R> map(UpdateOp<T> $self, Function1<T, R> transform)

        Transforms the value for set operations by calling the provided transform function and creating a new set operation; none operations are returned as is.

        Parameters:
        transform - Function to be called for set operations to transform the value.
      • getOrDefault

         final static <T extends Any> T getOrDefault(UpdateOp<T> $self, Function0<T> current)

        Retrieves a value depending on the patch operation where none is mapped to the value returned by given the current function.

        • set - If the patch is a set, the new value will be returned.

        • none - If the patch is none, the value returned by current will be returned.

        Parameters:
        current - Value to be returned when the patch operation is none.