Interface AclInterfaceCache

  • All Known Implementing Classes:
    AclInterfaceCacheImpl

    public interface AclInterfaceCache
    Interface for an AclInterface cache.
    Author:
    Thomas Pantelis
    • Method Detail

      • addOrUpdate

        @NonNull AclInterface addOrUpdate​(@NonNull java.lang.String interfaceId,
                                          @NonNull java.util.function.BiConsumer<AclInterface,​AclInterface.Builder> updateFunction)
        Adds a new AclInterface if not already existing, otherwise updates the existing instance. In either case, the given updateFunction is used to build a new instance.
        Parameters:
        interfaceId - the interface Id
        updateFunction - the function used to build a new instance from the provided AclInterface.Builder. If an instance already exists in the cache, the previous instance is passed to the function and the Builder is initially populated from the existing instance.
        Returns:
        the new or updated AclInterface
      • updateIfPresent

        @Nullable AclInterface updateIfPresent​(@NonNull java.lang.String interfaceId,
                                               @NonNull java.util.function.BiFunction<AclInterface,​AclInterface.Builder,​java.lang.Boolean> updateFunction)
        Updates an existing AclInterface instance in the cache. The given updateFunction is used to build a new instance.
        Parameters:
        interfaceId - the interface Id
        updateFunction - the function used to build a new instance from the provided AclInterface.Builder. The previous instance is passed to the function and the Builder is initially populated from the existing instance. The function returns a boolean indicating if any updates were actually made.
        Returns:
        the updated AclInterface or null if no instance was present or no updates were made
      • remove

        AclInterface remove​(@NonNull java.lang.String interfaceId)
        Removes an AclInterface instance from the cache.
        Parameters:
        interfaceId - the interface Id
        Returns:
        the AclInterface if present, null oherwise
      • get

        @Nullable AclInterface get​(@NonNull java.lang.String interfaceId)
        Gets an AclInterface instance from the cache if present.
        Parameters:
        interfaceId - the interface Id
        Returns:
        the AclInterface instance if found, null otherwise
      • entries

        @NonNull java.util.Collection<java.util.Map.Entry<java.lang.String,​AclInterface>> entries()