Class SerializableCacheKey
java.lang.Object
com.sap.cloud.sdk.cloudplatform.cache.SerializableCacheKey
- All Implemented Interfaces:
GenericCacheKey<SerializableCacheKey,
,Serializable> Serializable
public final class SerializableCacheKey
extends Object
implements GenericCacheKey<SerializableCacheKey,Serializable>, Serializable
SerializableCacheKey with either global visibility, tenant isolation, or tenant and principal isolation. The cache
key components are guaranteed to be serializable.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionappend
(Iterable<Serializable> objects) Appends the given Objects to this instance.boolean
Getter for the list of additional cache key components.io.vavr.control.Option<String>
Getter for the name of the principal for which the key is used.io.vavr.control.Option<String>
Getter for the Id of the tenant for which the key is used.int
hashCode()
static SerializableCacheKey
Constructs aCacheKey
for the given tenant and principal identifier, independent of whether they arenull
or not.static SerializableCacheKey
Constructs aSerializableCacheKey
for the given tenant and principal identifier, independent of whether they arenull
or not.toString()
-
Method Details
-
getTenantId
Description copied from interface:GenericCacheKey
Getter for the Id of the tenant for which the key is used.- Specified by:
getTenantId
in interfaceGenericCacheKey<SerializableCacheKey,
Serializable> - Returns:
- The tenant identifier.
-
getPrincipalId
Description copied from interface:GenericCacheKey
Getter for the name of the principal for which the key is used.- Specified by:
getPrincipalId
in interfaceGenericCacheKey<SerializableCacheKey,
Serializable> - Returns:
- The principal identifier.
-
append
@Nonnull public SerializableCacheKey append(@Nonnull Iterable<Serializable> objects) throws IllegalArgumentException Description copied from interface:GenericCacheKey
Appends the given Objects to this instance. In order to compare cache keys,Object.equals(Object)
andObject.hashCode()
are used. The given objects must not benull
.- Specified by:
append
in interfaceGenericCacheKey<SerializableCacheKey,
Serializable> - Parameters:
objects
- Additional objects that should be used to identify a cache key.- Returns:
- This instance with the objects added.
- Throws:
IllegalArgumentException
- If any of the given objects isnull
.
-
of
@Nonnull public static SerializableCacheKey of(@Nullable String tenantId, @Nullable String principalId) Constructs aSerializableCacheKey
for the given tenant and principal identifier, independent of whether they arenull
or not. This provides the highest flexibility for defining different levels of isolation.- Parameters:
tenantId
- The identifier of the tenant. Ifnull
, there is no tenant isolation.principalId
- The identifier of the principal. Ifnull
, there is no principal isolation.- Returns:
- A new
CacheKey
constructed from the given tenant and principal identifier.
-
of
@Nonnull public static SerializableCacheKey of(@Nullable Tenant tenant, @Nullable Principal principal) Constructs aCacheKey
for the given tenant and principal identifier, independent of whether they arenull
or not. This provides the highest flexibility for defining different levels of isolation.- Parameters:
tenant
- The tenant. Ifnull
, there is not tenant isolation.principal
- The principal. Ifnull
, there is no principal isolation.- Returns:
- A new
CacheKey
constructed from the given tenant and principal identifier.
-
equals
-
hashCode
public int hashCode() -
toString
-
getComponents
Description copied from interface:GenericCacheKey
Getter for the list of additional cache key components.- Specified by:
getComponents
in interfaceGenericCacheKey<SerializableCacheKey,
Serializable> - Returns:
- The list of additional cache key components.
-