-
Notifications
You must be signed in to change notification settings - Fork 242
/
EntityReferenceProjectionOptionsStepImpl.java
34 lines (27 loc) · 1.36 KB
/
EntityReferenceProjectionOptionsStepImpl.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/*
* Hibernate Search, full-text search for your domain model
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
package org.hibernate.search.engine.search.projection.dsl.impl;
import org.hibernate.search.engine.search.projection.SearchProjection;
import org.hibernate.search.engine.search.projection.dsl.EntityReferenceProjectionOptionsStep;
import org.hibernate.search.engine.search.projection.spi.EntityReferenceProjectionBuilder;
import org.hibernate.search.engine.search.projection.spi.SearchProjectionBuilderFactory;
public class EntityReferenceProjectionOptionsStepImpl<R> implements EntityReferenceProjectionOptionsStep<R> {
private final EntityReferenceProjectionBuilder<R> entityReferenceProjectionBuilder;
EntityReferenceProjectionOptionsStepImpl(SearchProjectionBuilderFactory factory) {
this.entityReferenceProjectionBuilder = factory.entityReference();
}
@Override
/*
* The backend has no control over the type of entities.
* This cast is only safe because we make sure to only use SearchProjectionFactory
* with generic type arguments that are consistent with the type of entity loaders.
* See comments in MappedIndexScope.
*/
public SearchProjection<R> toProjection() {
return entityReferenceProjectionBuilder.build();
}
}