Interface TypeAssertion<K,​V>

    • Field Detail

      • WITHOUT_TYPE_CHECKING

        static final TypeAssertion WITHOUT_TYPE_CHECKING
        When used no type checking will occur and no warnings will be generated.
      • WITH_RAW_TYPES

        static final TypeAssertion WITH_RAW_TYPES
        When used warnings will be issued where types are configured but not used.
    • Method Detail

      • assertTypeSafety

        boolean assertTypeSafety​(String sCacheName,
                                 CacheMapping cacheMapping,
                                 boolean fLog)
                          throws IllegalArgumentException
        Asserts the type compatibility of a named cache given the CacheMapping that defines the cache.
        Parameters:
        sCacheName - the name of the cache
        cacheMapping - 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.
        Returns:
        false if warning logged about the assertion, true otherwise.
        Throws:
        IllegalArgumentException - when types used with the TypeAssertion are illegal according to the configuration
      • withTypes

        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.
        Type Parameters:
        K - the key type
        V - the value type
        Parameters:
        clsKey - the desired key type
        clsValue - the desired value type
        Returns:
        a TypeAssertion
      • withRawTypes

        @Default
        static TypeAssertion withRawTypes()
        Obtains a 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.
        Returns:
        a TypeAssertion
      • withoutTypeChecking

        static <K,​V> TypeAssertion<K,​V> withoutTypeChecking()
        Obtains a TypeAssertion that allows NamedCaches to be acquired without type-checking, warnings or log messages.
        Type Parameters:
        K - the key type
        V - the value type
        Returns:
        a TypeAssertion