public class DelegatingSearchProjectionFactory<R,E> extends Object implements SearchProjectionFactory<R,E>
| Constructor and Description |
|---|
DelegatingSearchProjectionFactory(SearchProjectionFactory<R,E> delegate) |
| Modifier and Type | Method and Description |
|---|---|
<P1,P2,T> CompositeProjectionOptionsStep<?,T> |
composite(BiFunction<P1,P2,T> transformer,
SearchProjection<P1> projection1,
SearchProjection<P2> projection2)
Create a projection that will compose a custom object based on two given projections.
|
<T> CompositeProjectionOptionsStep<?,T> |
composite(Function<List<?>,T> transformer,
SearchProjection<?>... projections)
Create a projection that will compose a custom object based on the given projections.
|
<P,T> CompositeProjectionOptionsStep<?,T> |
composite(Function<P,T> transformer,
SearchProjection<P> projection)
Create a projection that will compose a custom object based on one given projection.
|
<P1,P2,P3,T> |
composite(TriFunction<P1,P2,P3,T> transformer,
SearchProjection<P1> projection1,
SearchProjection<P2> projection2,
SearchProjection<P3> projection3)
Create a projection that will compose a custom object based on three given projections.
|
DistanceToFieldProjectionOptionsStep<?> |
distance(String absoluteFieldPath,
GeoPoint center)
Project on the distance from the center to a
GeoPoint field. |
DocumentReferenceProjectionOptionsStep<?> |
documentReference()
Project the match to a
DocumentReference. |
EntityProjectionOptionsStep<?,E> |
entity()
Project to the entity was originally indexed.
|
EntityReferenceProjectionOptionsStep<?,R> |
entityReference()
Project to a reference to the entity that was originally indexed.
|
<P> SearchProjectionFactoryExtensionIfSupportedStep<P,R,E> |
extension()
Create a DSL step allowing multiple attempts to apply extensions one after the other,
failing only if none of the extensions is supported.
|
<T> T |
extension(SearchProjectionFactoryExtension<T,R,E> extension)
Extend the current factory with the given extension,
resulting in an extended factory offering different types of projections.
|
<T> FieldProjectionOptionsStep<?,T> |
field(String absoluteFieldPath,
Class<T> type,
ValueConvert convert)
Project to the value of a field in the indexed document.
|
FieldProjectionOptionsStep<?,Object> |
field(String absoluteFieldPath,
ValueConvert convert)
Project to the value of a field in the indexed document, without specifying a type.
|
ScoreProjectionOptionsStep<?> |
score()
Project on the score of the hit.
|
public DelegatingSearchProjectionFactory(SearchProjectionFactory<R,E> delegate)
public DocumentReferenceProjectionOptionsStep<?> documentReference()
SearchProjectionFactoryDocumentReference.documentReference in interface SearchProjectionFactory<R,E>public EntityReferenceProjectionOptionsStep<?,R> entityReference()
SearchProjectionFactoryThe actual type of the reference depends on the mapper used to create the query: the ORM mapper will return a class/identifier pair, for example.
entityReference in interface SearchProjectionFactory<R,E>public EntityProjectionOptionsStep<?,E> entity()
SearchProjectionFactoryThe actual type of the entity depends on the mapper used to create the query and on the indexes targeted by your query: the ORM mapper will return a managed entity loaded from the database, for example.
entity in interface SearchProjectionFactory<R,E>public <T> FieldProjectionOptionsStep<?,T> field(String absoluteFieldPath, Class<T> type, ValueConvert convert)
SearchProjectionFactoryfield in interface SearchProjectionFactory<R,E>T - The resulting type of the projection.absoluteFieldPath - The absolute path of the field.type - The resulting type of the projection.convert - Controls how the data fetched from the backend should be converted.
See ValueConvert.public FieldProjectionOptionsStep<?,Object> field(String absoluteFieldPath, ValueConvert convert)
SearchProjectionFactoryfield in interface SearchProjectionFactory<R,E>absoluteFieldPath - The absolute path of the field.convert - Controls how the data fetched from the backend should be converted.
See ValueConvert.public ScoreProjectionOptionsStep<?> score()
SearchProjectionFactoryscore in interface SearchProjectionFactory<R,E>public DistanceToFieldProjectionOptionsStep<?> distance(String absoluteFieldPath, GeoPoint center)
SearchProjectionFactoryGeoPoint field.distance in interface SearchProjectionFactory<R,E>absoluteFieldPath - The absolute path of the field.center - The center to compute the distance from.public <T> CompositeProjectionOptionsStep<?,T> composite(Function<List<?>,T> transformer, SearchProjection<?>... projections)
SearchProjectionFactorycomposite in interface SearchProjectionFactory<R,E>T - The type of the custom object composing the projected elements.transformer - The function that will transform the list of projected elements into a custom object.projections - The projections used to populate the list, in order.public <P,T> CompositeProjectionOptionsStep<?,T> composite(Function<P,T> transformer, SearchProjection<P> projection)
SearchProjectionFactorycomposite in interface SearchProjectionFactory<R,E>P - The type of the element passed to the transformer.T - The type of the custom object composing the projected element.transformer - The function that will transform the projected element into a custom object.projection - The original projection used to produce the element passed to the transformer.public <P1,P2,T> CompositeProjectionOptionsStep<?,T> composite(BiFunction<P1,P2,T> transformer, SearchProjection<P1> projection1, SearchProjection<P2> projection2)
SearchProjectionFactorycomposite in interface SearchProjectionFactory<R,E>P1 - The type of the first element passed to the transformer.P2 - The type of the second element passed to the transformer.T - The type of the custom object composing the projected elements.transformer - The function that will transform the projected elements into a custom object.projection1 - The projection used to produce the first element passed to the transformer.projection2 - The projection used to produce the second element passed to the transformer.public <P1,P2,P3,T> CompositeProjectionOptionsStep<?,T> composite(TriFunction<P1,P2,P3,T> transformer, SearchProjection<P1> projection1, SearchProjection<P2> projection2, SearchProjection<P3> projection3)
SearchProjectionFactorycomposite in interface SearchProjectionFactory<R,E>P1 - The type of the first element passed to the transformer.P2 - The type of the second element passed to the transformer.P3 - The type of the third element passed to the transformer.T - The type of the custom object composing the projected elements.transformer - The function that will transform the projected elements into a custom object.projection1 - The projection used to produce the first element passed to the transformer.projection2 - The projection used to produce the second element passed to the transformer.projection3 - The projection used to produce the third element passed to the transformer.public <T> T extension(SearchProjectionFactoryExtension<T,R,E> extension)
SearchProjectionFactoryextension in interface SearchProjectionFactory<R,E>T - The type of factory provided by the extension.extension - The extension to the projection DSL.public <P> SearchProjectionFactoryExtensionIfSupportedStep<P,R,E> extension()
SearchProjectionFactory
If you only need to apply a single extension and fail if it is not supported,
use the simpler SearchProjectionFactory.extension(SearchProjectionFactoryExtension) method instead.
This method is generic, and you should set the generic type explicitly to the expected projected type,
e.g. .<MyProjectedType>extension().
extension in interface SearchProjectionFactory<R,E>P - The expected projected type.Copyright © 2006-2020 Red Hat, Inc. and others. Licensed under the GNU Lesser General Public License (LGPL), version 2.1 or later.