Package com.tangosol.net.cache
Interface TypeAssertion<K,V>
- Type Parameters:
K
- the type of the cache entry keysV
- the type of the cache entry values
- All Superinterfaces:
NamedMap.Option
- All Known Implementing Classes:
TypeAssertion.WithTypesAssertion
Defines a
NamedMap.Option
for asserting the type
of keys and values used with a NamedCache
.- Since:
- Coherence 12.2.1
- Author:
- bko 2015.06.15
-
Nested Class Summary
-
Field Summary
Modifier and TypeFieldDescriptionstatic final TypeAssertion
When used warnings will be issued where types are configured but not used.static final TypeAssertion
When used no type checking will occur and no warnings will be generated. -
Method Summary
Modifier and TypeMethodDescriptiondefault boolean
assertTypeSafety
(String sCacheName, CacheMapping cacheMapping) Asserts the type compatibility of a named cache given theCacheMapping
that defines the cache.boolean
assertTypeSafety
(String sCacheName, CacheMapping cacheMapping, boolean fLog) Asserts the type compatibility of a named cache given theCacheMapping
that defines the cache.static <K,
V> TypeAssertion <K, V> Obtains aTypeAssertion
that allows NamedCaches to be acquired without type-checking, warnings or log messages.static TypeAssertion
Obtains aTypeAssertion
that allows NamedCaches to be acquired and assigned to a raw NamedCache reference.static <K,
V> TypeAssertion <K, V> Obtains aTypeAssertion
that asserts the specified types are configured for a cache.
-
Field Details
-
WITHOUT_TYPE_CHECKING
When used no type checking will occur and no warnings will be generated. -
WITH_RAW_TYPES
When used warnings will be issued where types are configured but not used.
-
-
Method Details
-
assertTypeSafety
boolean assertTypeSafety(String sCacheName, CacheMapping cacheMapping, boolean fLog) throws IllegalArgumentException Asserts the type compatibility of a named cache given theCacheMapping
that defines the cache.- Parameters:
sCacheName
- the name of the cachecacheMapping
- theCacheMapping
fLog
- when true, log warning if typing mismatch betweenCacheMapping
configuration and thisTypeAssertion
; specifically, one uses raw types and the other asserts specific types.- Returns:
- false if warning logged about the assertion, true otherwise.
- Throws:
IllegalArgumentException
- when types used with theTypeAssertion
are illegal according to the configuration
-
assertTypeSafety
default boolean assertTypeSafety(String sCacheName, CacheMapping cacheMapping) throws IllegalArgumentException Asserts the type compatibility of a named cache given theCacheMapping
that defines the cache.- Parameters:
sCacheName
- the name of the cachecacheMapping
- theCacheMapping
- Returns:
- false if warning logged about the assertion, true otherwise.
- Throws:
IllegalArgumentException
- when types used with theTypeAssertion
are illegal according to the configuration
-
withTypes
Obtains aTypeAssertion
that asserts the specified types are configured for a cache.- Type Parameters:
K
- the key typeV
- the value type- Parameters:
clsKey
- the desired key typeclsValue
- the desired value type- Returns:
- a
TypeAssertion
-
withRawTypes
Obtains aTypeAssertion
that allows NamedCaches to be acquired and assigned to a raw NamedCache reference. A debug log message will be raised for caches that have been configured with specific types.- Returns:
- a
TypeAssertion
-
withoutTypeChecking
Obtains aTypeAssertion
that allows NamedCaches to be acquired without type-checking, warnings or log messages.- Type Parameters:
K
- the key typeV
- the value type- Returns:
- a
TypeAssertion
-