@Override
    public CacheConfiguration<K, V> setTypes(Class<K> keyType, Class<V> valueType) {
        if (keyType == null || valueType == null) {
            throw new NullPointerException("keyType and/or valueType can't be null");
        }
        setKeyType(keyType);
        setValueType(valueType);
        return this;
    }
@ Override public CacheConfiguration < K , V > setTypes ( Class < K > keyType , Class < V > valueType ) { if ( keyType == null || valueType == null ) { throw new NullPointerException ( "keyType and/or valueType can't be null" ) ; } setKeyType ( keyType ) ; setValueType ( valueType ) ; return this ; }
Sets the expected type of keys and values for a {@link javax.cache.Cache}
configured with this {@link javax.cache.configuration.Configuration}.
Setting both to {@code Object.class} means type-safety checks are not required.
<p>
This is used by {@link javax.cache.CacheManager} to ensure that the key and value
types are the same as those configured for the {@link javax.cache.Cache} prior to
returning a requested cache from this method.
<p>
Implementations may further perform type checking on mutative cache operations
and throw a {@link ClassCastException} if these checks fail.

@param keyType   the expected key type
@param valueType the expected value type
@return the {@link CacheConfig}
@throws NullPointerException should the key or value type be null
@see javax.cache.CacheManager#getCache(String, Class, Class)