Class InitializingAutoSuggestDataSet
java.lang.Object
com.foreach.across.modules.entity.autosuggest.InitializingAutoSuggestDataSet
- All Implemented Interfaces:
AutoSuggestDataSet
,AutoSuggestDataSet.ResultTransformer
public class InitializingAutoSuggestDataSet
extends Object
implements AutoSuggestDataSet, AutoSuggestDataSet.ResultTransformer
Implementation of
AutoSuggestDataSet
that also implements a
AutoSuggestDataSet.ResultTransformer
and allows for lazy initialization upon first use by specifying a setInitializer(Consumer)
.
Mainly used internally when registering auto-suggest dataset attributes.- Since:
- 3.4.0
- Author:
- Arne Vandamme
- See Also:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Nested classes/interfaces inherited from interface com.foreach.across.modules.entity.autosuggest.AutoSuggestDataSet
AutoSuggestDataSet.Result, AutoSuggestDataSet.ResultTransformer
-
Constructor Summary
ConstructorDescriptionInitializingAutoSuggestDataSet
(Consumer<InitializingAutoSuggestDataSet> initializer, @NonNull BiFunction<String, String, Object> suggestionsLoader, Function<String, Object> prefetchLoader, AutoSuggestDataSet.ResultTransformer resultTransformer, boolean initialized) -
Method Summary
Modifier and TypeMethodDescriptionbuilder()
Create a builder for a simple dataset.protected boolean
boolean
@NonNull BiFunction<String,
String, Object> int
hashCode()
boolean
Retrieve the prefetch data for this set.void
setInitializer
(Consumer<InitializingAutoSuggestDataSet> initializer) void
setPrefetchLoader
(Function<String, Object> prefetchLoader) void
setResultTransformer
(AutoSuggestDataSet.ResultTransformer resultTransformer) void
setSuggestionsLoader
(@NonNull BiFunction<String, String, Object> suggestionsLoader) suggestions
(String query, String controlName) Retrieve the suggestions for a particular query.toString()
transformToResult
(Object candidate)
-
Constructor Details
-
InitializingAutoSuggestDataSet
public InitializingAutoSuggestDataSet() -
InitializingAutoSuggestDataSet
public InitializingAutoSuggestDataSet(Consumer<InitializingAutoSuggestDataSet> initializer, @NonNull @NonNull BiFunction<String, String, Object> suggestionsLoader, Function<String, Object> prefetchLoader, @NonNull AutoSuggestDataSet.ResultTransformer resultTransformer, boolean initialized)
-
-
Method Details
-
suggestions
Description copied from interface:AutoSuggestDataSet
Retrieve the suggestions for a particular query. The second parameter is an optional control name for which the suggestions are requested.- Specified by:
suggestions
in interfaceAutoSuggestDataSet
- Parameters:
query
- usually the input of the usercontrolName
- name of the control for which the suggestions are requested- Returns:
- suggestions result
-
prefetch
Description copied from interface:AutoSuggestDataSet
Retrieve the prefetch data for this set. Prefetch data is the initial data that should be loaded and possibly shown as suggestions, without the user having entered a particular query string.- Specified by:
prefetch
in interfaceAutoSuggestDataSet
- Parameters:
controlName
- name of the control for which the suggestions are requested- Returns:
- suggestions result
-
isPrefetchSupported
public boolean isPrefetchSupported()- Specified by:
isPrefetchSupported
in interfaceAutoSuggestDataSet
- Returns:
- true if data from this set can be pre-fetched
-
transformToResult
- Specified by:
transformToResult
in interfaceAutoSuggestDataSet.ResultTransformer
-
builder
Description copied from interface:AutoSuggestDataSet
Create a builder for a simple dataset. Using a- Returns:
- builder for a simple auto-suggest dataset
-
getInitializer
-
getSuggestionsLoader
-
getPrefetchLoader
-
getResultTransformer
-
setInitializer
-
setSuggestionsLoader
public void setSuggestionsLoader(@NonNull @NonNull BiFunction<String, String, Object> suggestionsLoader) -
setPrefetchLoader
-
setResultTransformer
-
equals
-
canEqual
-
hashCode
public int hashCode() -
toString
-