Class ProjectionBindingContextImpl<P>
java.lang.Object
org.hibernate.search.mapper.pojo.search.definition.binding.impl.ProjectionBindingContextImpl<P>
- All Implemented Interfaces:
ProjectionBindingContext
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionProjectionBindingContextImpl(org.hibernate.search.mapper.pojo.search.definition.binding.impl.ProjectionConstructorParameterBinder<P> parameterBinder, Map<String, Object> params) -
Method Summary
Modifier and TypeMethodDescriptionBeanHolder<? extends ProjectionDefinition<? extends P>>applyBinder(ProjectionBinder binder) BeanHolder<? extends ProjectionDefinition<?>><T> BeanHolder<? extends ProjectionDefinition<T>>createCompositeDefinition(Class<T> projectedType) <T> BeanHolder<? extends ProjectionDefinition<T>>createObjectDefinition(String fieldPath, Class<T> projectedType, TreeFilterDefinition filter) <T> BeanHolder<? extends ProjectionDefinition<List<T>>>createObjectDefinitionMulti(String fieldPath, Class<T> projectedType, TreeFilterDefinition filter) <P2> voiddefinition(Class<P2> expectedValueType, BeanHolder<? extends ProjectionDefinition<? extends P2>> definitionHolder) Binds theProjectionBindingContext.constructorParameter()to the given projection definition.<P2> voiddefinition(Class<P2> expectedValueType, ProjectionDefinition<? extends P2> definition) Binds theProjectionBindingContext.constructorParameter()to the given projection definition.booleanisIncluded(String fieldPath) multi()Inspects the type of theProjectionBindingContext.constructorParameter()to determine if it may be bound to a multi-valued projection.<T> T<T> Optional<T>paramOptional(String name, Class<T> paramType) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.hibernate.search.mapper.pojo.search.definition.binding.ProjectionBindingContext
param, paramOptional
-
Constructor Details
-
ProjectionBindingContextImpl
-
-
Method Details
-
beanResolver
- Specified by:
beanResolverin interfaceProjectionBindingContext- Returns:
- A bean provider, allowing the retrieval of beans, including CDI/Spring DI beans when in the appropriate environment.
-
param
- Specified by:
paramin interfaceProjectionBindingContext- Type Parameters:
T- The type of the parameter.- Parameters:
name- The name of the parameter.paramType- The type of the parameter.- Returns:
- The value provided for this parameter.
- See Also:
-
paramOptional
- Specified by:
paramOptionalin interfaceProjectionBindingContext- Type Parameters:
T- The type of the parameter.- Parameters:
name- The name of the parameter.paramType- The type of the parameter.- Returns:
- An optional containing the value provided for this parameter,
or
Optional.empty()if no value was provided for this parameter. - See Also:
-
definition
public <P2> void definition(Class<P2> expectedValueType, ProjectionDefinition<? extends P2> definition) Description copied from interface:ProjectionBindingContextBinds theProjectionBindingContext.constructorParameter()to the given projection definition.- Specified by:
definitionin interfaceProjectionBindingContext- Type Parameters:
P2- The type of values returned by the projection.- Parameters:
expectedValueType- The expected type of theProjectionBindingContext.constructorParameter(), which must be compatible with the given projection definition. Hibernate Search will check that these expectations are met, and throw an exception if they are not.definition- A definition of the projection to bind to theProjectionBindingContext.constructorParameter().
-
definition
public <P2> void definition(Class<P2> expectedValueType, BeanHolder<? extends ProjectionDefinition<? extends P2>> definitionHolder) Description copied from interface:ProjectionBindingContextBinds theProjectionBindingContext.constructorParameter()to the given projection definition.- Specified by:
definitionin interfaceProjectionBindingContext- Type Parameters:
P2- The type of values returned by the projection.- Parameters:
expectedValueType- The expected type of theProjectionBindingContext.constructorParameter(), which must be compatible with the given projection definition. Hibernate Search will check that these expectations are met, and throw an exception if they are not.definitionHolder- ABeanHoldercontaining the definition of the projection to bind to theProjectionBindingContext.constructorParameter().
-
multi
Description copied from interface:ProjectionBindingContextInspects the type of theProjectionBindingContext.constructorParameter()to determine if it may be bound to a multi-valued projection.- Specified by:
multiin interfaceProjectionBindingContext- Returns:
- An optional containing a context that can be used to bind a projection
if the type of the
ProjectionBindingContext.constructorParameter()can be bound to a multi-valued projection; an empty optional otherwise.
-
constructorParameter
- Specified by:
constructorParameterin interfaceProjectionBindingContext- Returns:
- An entry point allowing to inspect the constructor parameter being bound to a projection.
-
createObjectDefinition
public <T> BeanHolder<? extends ProjectionDefinition<T>> createObjectDefinition(String fieldPath, Class<T> projectedType, TreeFilterDefinition filter) - Specified by:
createObjectDefinitionin interfaceProjectionBindingContext- Parameters:
fieldPath- The (relative) path to an object field in the indexed document.projectedType- A type expected to have a corresponding projection mapping (e.g. usingProjectionConstructor).filter- The filter to apply to determine which nested index field projections should be included in the projection. SeeObjectProjection.includePaths(),ObjectProjection.excludePaths(),ObjectProjection.includeDepth(), ...- Returns:
- A single-valued object projection definition for the given type.
- See Also:
-
createObjectDefinitionMulti
public <T> BeanHolder<? extends ProjectionDefinition<List<T>>> createObjectDefinitionMulti(String fieldPath, Class<T> projectedType, TreeFilterDefinition filter) - Specified by:
createObjectDefinitionMultiin interfaceProjectionBindingContext- Parameters:
fieldPath- The (relative) path to an object field in the indexed document.projectedType- A type expected to have a corresponding projection mapping (e.g. usingProjectionConstructor).filter- The filter to apply to determine which nested index field projections should be included in the projection. SeeObjectProjection.includePaths(),ObjectProjection.excludePaths(),ObjectProjection.includeDepth(), ...- Returns:
- A multi-valued object projection definition for the given type.
- See Also:
-
createCompositeDefinition
public <T> BeanHolder<? extends ProjectionDefinition<T>> createCompositeDefinition(Class<T> projectedType) - Specified by:
createCompositeDefinitionin interfaceProjectionBindingContext- Parameters:
projectedType- A type expected to have a corresponding projection mapping (e.g. usingProjectionConstructor)- Returns:
- A composite projection definition for the given type.
- See Also:
-
isIncluded
- Specified by:
isIncludedin interfaceProjectionBindingContext- Parameters:
fieldPath- The (relative) path to an object field in the indexed document.- Returns:
trueif the field with the given path is included according to surroundingfilters(seeObjectProjection.includePaths(),ObjectProjection.excludePaths(),ObjectProjection.includeDepth(), ...).falseotherwise. Projections on excluded fields should be replaced with a constant projection returningnullor an empty list, as appropriate.
-
applyBinder
-
applyDefaultProjection
-