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 AclInterfaceaddOrUpdate(@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()AclInterfaceget(java.lang.String interfaceId)Gets an AclInterface instance from the cache if present.@Nullable AclInterfaceremove(java.lang.String interfaceId)Removes an AclInterface instance from the cache.AclInterfaceupdateIfPresent(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:AclInterfaceCacheAdds 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:
addOrUpdatein 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:AclInterfaceCacheUpdates an existing AclInterface instance in the cache. The given updateFunction is used to build a new instance.- Specified by:
updateIfPresentin 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:AclInterfaceCacheRemoves an AclInterface instance from the cache.- Specified by:
removein 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:AclInterfaceCacheGets an AclInterface instance from the cache if present.- Specified by:
getin 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:
entriesin interfaceAclInterfaceCache
-
-