Class AclInterfaceCacheImpl
- java.lang.Object
-
- org.opendaylight.netvirt.aclservice.AclInterfaceCacheImpl
-
- All Implemented Interfaces:
AclInterfaceCache
@Singleton public class AclInterfaceCacheImpl extends java.lang.Object implements AclInterfaceCache
Implementation of the AclInterfaceCache interface.- Author:
- Thomas Pantelis
-
-
Constructor Summary
Constructors Constructor Description AclInterfaceCacheImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AclInterface
addOrUpdate(@NonNull java.lang.String interfaceId, java.util.function.BiConsumer<AclInterface,AclInterface.Builder> updateFunction)
Adds a new AclInterface if not already existing, otherwise updates the existing instance.java.util.Collection<java.util.Map.Entry<java.lang.String,AclInterface>>
entries()
AclInterface
get(java.lang.String interfaceId)
Gets an AclInterface instance from the cache if present.@Nullable AclInterface
remove(java.lang.String interfaceId)
Removes an AclInterface instance from the cache.AclInterface
updateIfPresent(java.lang.String interfaceId, java.util.function.BiFunction<AclInterface,AclInterface.Builder,java.lang.Boolean> updateFunction)
Updates an existing AclInterface instance in the cache.
-
-
-
Method Detail
-
addOrUpdate
public AclInterface addOrUpdate(@NonNull java.lang.String interfaceId, java.util.function.BiConsumer<AclInterface,AclInterface.Builder> updateFunction)
Description copied from interface:AclInterfaceCache
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.- Specified by:
addOrUpdate
in interfaceAclInterfaceCache
- Parameters:
interfaceId
- the interface IdupdateFunction
- 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
public AclInterface updateIfPresent(java.lang.String interfaceId, java.util.function.BiFunction<AclInterface,AclInterface.Builder,java.lang.Boolean> updateFunction)
Description copied from interface:AclInterfaceCache
Updates an existing AclInterface instance in the cache. The given updateFunction is used to build a new instance.- Specified by:
updateIfPresent
in interfaceAclInterfaceCache
- Parameters:
interfaceId
- the interface IdupdateFunction
- 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
public @Nullable AclInterface remove(java.lang.String interfaceId)
Description copied from interface:AclInterfaceCache
Removes an AclInterface instance from the cache.- Specified by:
remove
in interfaceAclInterfaceCache
- Parameters:
interfaceId
- the interface Id- Returns:
- the AclInterface if present, null oherwise
-
get
public AclInterface get(java.lang.String interfaceId)
Description copied from interface:AclInterfaceCache
Gets an AclInterface instance from the cache if present.- Specified by:
get
in interfaceAclInterfaceCache
- Parameters:
interfaceId
- the interface Id- Returns:
- the AclInterface instance if found, null otherwise
-
entries
public java.util.Collection<java.util.Map.Entry<java.lang.String,AclInterface>> entries()
- Specified by:
entries
in interfaceAclInterfaceCache
-
-