K
- the type of the cache entry keysV
- the type of the cache entry valuespublic interface TypeAssertion<K,V> extends NamedCache.Option
NamedCache.Option
for asserting the type
of keys and values used with a NamedCache
.Modifier and Type | Interface and Description |
---|---|
static class |
TypeAssertion.WithTypesAssertion<K,V> |
Modifier and Type | Field and Description |
---|---|
static TypeAssertion |
WITH_RAW_TYPES
When used warnings will be issued where types are configured but not used.
|
static TypeAssertion |
WITHOUT_TYPE_CHECKING
When used no type checking will occur and no warnings will be generated.
|
Modifier and Type | Method and Description |
---|---|
default boolean |
assertTypeSafety(String sCacheName,
CacheMapping cacheMapping)
Asserts the type compatibility of a named cache given the
CacheMapping that defines the cache. |
boolean |
assertTypeSafety(String sCacheName,
CacheMapping cacheMapping,
boolean fLog)
Asserts the type compatibility of a named cache given the
CacheMapping that defines the cache. |
static <K,V> TypeAssertion<K,V> |
withoutTypeChecking()
Obtains a
TypeAssertion that allows NamedCaches to be acquired
without type-checking, warnings or log messages. |
static TypeAssertion |
withRawTypes()
Obtains a
TypeAssertion that allows NamedCaches to be acquired
and assigned to a raw NamedCache reference. |
static <K,V> TypeAssertion<K,V> |
withTypes(Class<K> clsKey,
Class<V> clsValue)
Obtains a
TypeAssertion that asserts the specified types are
configured for a cache. |
static final TypeAssertion WITHOUT_TYPE_CHECKING
static final TypeAssertion WITH_RAW_TYPES
boolean assertTypeSafety(String sCacheName, CacheMapping cacheMapping, boolean fLog) throws IllegalArgumentException
CacheMapping
that defines the cache.sCacheName
- the name of the cachecacheMapping
- the CacheMapping
fLog
- when true, log warning if typing mismatch between CacheMapping
configuration
and this TypeAssertion
; specifically, one uses raw types and the other
asserts specific types.IllegalArgumentException
- when types used with the TypeAssertion
are illegal according to the configurationdefault boolean assertTypeSafety(String sCacheName, CacheMapping cacheMapping) throws IllegalArgumentException
CacheMapping
that defines the cache.sCacheName
- the name of the cachecacheMapping
- the CacheMapping
IllegalArgumentException
- when types used with the TypeAssertion
are illegal according to the configurationstatic <K,V> TypeAssertion<K,V> withTypes(Class<K> clsKey, Class<V> clsValue)
TypeAssertion
that asserts the specified types are
configured for a cache.K
- the key typeV
- the value typeclsKey
- the desired key typeclsValue
- the desired value typeTypeAssertion
@Options.Default static TypeAssertion withRawTypes()
TypeAssertion
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.TypeAssertion
static <K,V> TypeAssertion<K,V> withoutTypeChecking()
TypeAssertion
that allows NamedCaches to be acquired
without type-checking, warnings or log messages.K
- the key typeV
- the value typeTypeAssertion