Package com.blamejared.searchables.api
Class SearchableComponent<T>
java.lang.Object
com.blamejared.searchables.api.SearchableComponent<T>
A component of a
SearchableType<T>.-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> SearchableComponent<T> create(String key, BiPredicate<T, String> filter) Creates a component that will not show in auto-complete, but will still be able to be filteredstatic <T> SearchableComponent<T> Creates a component from the given values, that uses thetoStringfunction to filter based on if the name of the element contains the given search string (case-insensitive)static <T> SearchableComponent<T> Creates a component from the given values.filter()key()toString()
-
Method Details
-
create
Creates a component that will not show in auto-complete, but will still be able to be filtered- Type Parameters:
T- The type of element that thisSearchableComponent<T>handles.- Parameters:
key- The key for this term.filter- aBiPredicateto filter the element (T) and the given search String- Returns:
- a new
SearchableComponent<T>from the given values.
-
create
public static <T> SearchableComponent<T> create(String key, Function<T, Optional<String>> toString, BiPredicate<T, String> filter) Creates a component from the given values.- Type Parameters:
T- The type of element that thisSearchableComponent<T>handles.- Parameters:
key- The key for this term.toString- aFunctionto convert a givenTto anOptional<String>, used to display the "name" of an element for auto-completefilter- aBiPredicateto filter the element (T) and the given search String- Returns:
- a new
SearchableComponent<T>from the given values.
-
create
Creates a component from the given values, that uses thetoStringfunction to filter based on if the name of the element contains the given search string (case-insensitive)- Type Parameters:
T- The type of element that thisSearchableComponent<T>handles.- Parameters:
key- The key for this term.toString- aFunctionto convert a givenTto anOptional<String>, used to display the "name" of an element for auto-complete and for filtering.- Returns:
- a new
SearchableComponent<T>from the given values.
-
key
-
filter
-
getToString
-
toString
-