DefaultCouchbaseBucketManagerFactory implements CouchbaseBucketManagerFactory { @Override public <K, V> Map<K, V> getMap(String bucketName, Class<K> keyValue, Class<V> valueValue) { requireNonNull(bucketName, "bucketName is required"); requireNonNull(valueValue, "valueValue is required"); requireNonNull(keyValue, "keyValue is required"); if(!String.class.isAssignableFrom(keyValue)) { throw new UnsupportedOperationException("Couchbase Map does not support a not String key instead of: " + keyValue); } if (JsonValueCheck.checkType(valueValue)) { return (Map<K, V>) new com.couchbase.client.java.datastructures.collections. CouchbaseMap<V>(bucketName + ":map", getBucket(bucketName)); } else { return new CouchbaseMap<>(getBucket(bucketName), bucketName, keyValue, valueValue); } } DefaultCouchbaseBucketManagerFactory(CouchbaseCluster couchbaseCluster, String user, String password); @Override CouchbaseBucketManager getBucketManager(String bucketName); @Override Map<K, V> getMap(String bucketName, Class<K> keyValue, Class<V> valueValue); @Override Map<K, V> getMap(String bucketName, String key, Class<K> keyValue, Class<V> valueValue); @Override Queue<T> getQueue(String bucketName, Class<T> clazz); @Override Set<T> getSet(String bucketName, Class<T> clazz); @Override List<T> getList(String bucketName, Class<T> clazz); @Override Queue<T> getQueue(String bucketName, String key, Class<T> clazz); @Override Set<T> getSet(String bucketName, String key, Class<T> clazz); @Override List<T> getList(String bucketName, String key, Class<T> clazz); @Override void close();  }
@Test public void shouldReturnMap() { assertTrue(factory.getMap("jnosql", String.class, String.class) instanceof com.couchbase.client.java.datastructures.collections.CouchbaseMap); assertTrue(factory.getMap("jnosql", String.class, User.class) instanceof CouchbaseMap); assertTrue(factory.getMap("jnosql", "jnosql", String.class, String.class) instanceof com.couchbase.client.java.datastructures.collections.CouchbaseMap); assertTrue(factory.getMap("jnosql", "jnosql", String.class, User.class) instanceof CouchbaseMap); }