private ArangoCollection _collection( final String name, final ArangoPersistentEntity<?> persistentEntity, final CollectionCreateOptions options) { final ArangoDatabase db = db(); final Class<?> entityClass = persistentEntity != null ? persistentEntity.getType() : null; final CollectionCacheValue value = collectionCache.computeIfAbsent(new CollectionCacheKey(db.name(), name), key -> { final ArangoCollection collection = db.collection(name); if (!collection.exists()) { collection.create(options); } return new CollectionCacheValue(collection); }); final Collection<Class<?>> entities = value.getEntities(); final ArangoCollection collection = value.getCollection(); if (persistentEntity != null && !entities.contains(entityClass)) { value.addEntityClass(entityClass); ensureCollectionIndexes(collection(collection), persistentEntity); } return collection; }
private ArangoCollection _collection( final String name, final ArangoPersistentEntity<?> persistentEntity, final CollectionCreateOptions options) { final ArangoDatabase db = db(); final Class<?> entityClass = persistentEntity != null ? persistentEntity.getType() : null; final CollectionCacheValue value = collectionCache.computeIfAbsent(new CollectionCacheKey(db.name(), name), key -> { final ArangoCollection collection = db.collection(name); if (!collection.exists()) { collection.create(options); } return new CollectionCacheValue(collection); }); final Collection<Class<?>> entities = value.getEntities(); final ArangoCollection collection = value.getCollection(); if (persistentEntity != null && !entities.contains(entityClass)) { value.addEntityClass(entityClass); ensureCollectionIndexes(collection(collection), persistentEntity); } return collection; }