Class SymbolRegistryUtil
java.lang.Object
com.bluebell.greenhouse.platform.util.registry.SymbolRegistryUtil
Utility methods for filtering and sorting symbol registry collections.
- Version:
- 1.0.9
- Author:
- Stephen Prizio
-
Method Summary
Modifier and TypeMethodDescriptionstatic Comparator<SymbolRegistryEntry> getConfidenceComparator(org.springframework.data.domain.Sort.Direction direction) Returns a comparator for confidence values.static Comparator<SymbolRegistryEntry> Returns the default comparator used when no explicit sort is requested.static Comparator<SymbolRegistryEntry> getEntryComparator(SymbolRegistryEntrySortField sortField, org.springframework.data.domain.Sort.Direction direction) Returns the comparator for the given sort request.static Comparator<SymbolRegistryEntry> getStringComparator(Function<SymbolRegistryEntry, String> extractor, org.springframework.data.domain.Sort.Direction direction) Returns a comparator for a text field.static booleanmatchesBooleanFilter(Boolean filterValue, boolean actualValue) Returns true when a boolean field matches a boolean filter.static booleanmatchesConfidenceFilter(Double confidence, Double confidenceMin, Double confidenceMax) Returns true when an entry confidence matches the configured range.static booleanmatchesFilter(SymbolRegistryEntry entry, SymbolRegistryEntryFilter filter) Returns true when the given entry matches the supplied filter.static booleanmatchesSourceUrlFilter(String filterValue, List<String> sourceUrls) Returns true when a source URL filter matches any source URL on an entry.static booleanmatchesTextFilter(String filterValue, String actualValue) Returns true when a text field matches a text filter.
-
Method Details
-
matchesFilter
Returns true when the given entry matches the supplied filter.- Parameters:
entry- entryfilter- optional filter- Returns:
- true when the entry matches
-
getEntryComparator
public static Comparator<SymbolRegistryEntry> getEntryComparator(SymbolRegistryEntrySortField sortField, org.springframework.data.domain.Sort.Direction direction) Returns the comparator for the given sort request.- Parameters:
sortField- optional sort fielddirection- optional sort direction- Returns:
ComparatorofSymbolRegistryEntry
-
getDefaultEntryComparator
Returns the default comparator used when no explicit sort is requested.- Returns:
ComparatorofSymbolRegistryEntry
-
getStringComparator
public static Comparator<SymbolRegistryEntry> getStringComparator(Function<SymbolRegistryEntry, String> extractor, org.springframework.data.domain.Sort.Direction direction) Returns a comparator for a text field.- Parameters:
extractor- string extractordirection- sort direction- Returns:
ComparatorofSymbolRegistryEntry
-
getConfidenceComparator
public static Comparator<SymbolRegistryEntry> getConfidenceComparator(org.springframework.data.domain.Sort.Direction direction) Returns a comparator for confidence values.- Parameters:
direction- sort direction- Returns:
ComparatorofSymbolRegistryEntry
-
matchesTextFilter
-
matchesBooleanFilter
Returns true when a boolean field matches a boolean filter.- Parameters:
filterValue- filter valueactualValue- actual value- Returns:
- true when the filter matches
-
matchesSourceUrlFilter
-
matchesConfidenceFilter
public static boolean matchesConfidenceFilter(Double confidence, Double confidenceMin, Double confidenceMax) Returns true when an entry confidence matches the configured range.- Parameters:
confidence- confidenceconfidenceMin- optional minimum confidenceconfidenceMax- optional maximum confidence- Returns:
- true when the confidence matches
-