Class SearchSpec
-
- All Implemented Interfaces:
public final class SearchSpec<T extends Component>A criterion for matching components. The component must match all of non-null fields.
You can add more properties, simply by creating a write-only property which will register a new predicate on write. See Adding support for custom search criteria for more details.
-
-
Field Summary
Fields Modifier and Type Field Description private final Class<T>clazzprivate Stringidprivate Stringcaptionprivate Stringplaceholderprivate Stringtextprivate IntRangecountprivate Objectvalueprivate Stringclassesprivate StringwithoutClassesprivate List<Predicate<T>>predicatesprivate Stringthemesprivate StringwithoutThemes
-
Method Summary
Modifier and Type Method Description final Class<T>getClazz()the class of the component we are searching for. final StringgetId()the required Component.getId; if null, no particular id is matched. final UnitsetId(String id)the required Component.getId; if null, no particular id is matched. final StringgetCaption()the required Component.caption; if null, no particular caption is matched. final UnitsetCaption(String caption)the required Component.caption; if null, no particular caption is matched. final StringgetPlaceholder()the required Component.placeholder; if null, no particular placeholder is matched. final UnitsetPlaceholder(String placeholder)the required Component.placeholder; if null, no particular placeholder is matched. final StringgetText()the com.vaadin.flow.dom.Element.getText final UnitsetText(String text)the com.vaadin.flow.dom.Element.getText final IntRangegetCount()expected count of matching components, defaults to 0..Int.MAX_VALUEfinal UnitsetCount(IntRange count)expected count of matching components, defaults to 0..Int.MAX_VALUEfinal ObjectgetValue()expected com.vaadin.flow.component.HasValue.getValue; if null, no particular value is matched.final UnitsetValue(Object value)expected com.vaadin.flow.component.HasValue.getValue; if null, no particular value is matched.final StringgetClasses()if not null, the component must match all of these class names. final UnitsetClasses(String classes)if not null, the component must match all of these class names. final StringgetWithoutClasses()if not null, the component must NOT match any of these class names. final UnitsetWithoutClasses(String withoutClasses)if not null, the component must NOT match any of these class names. final List<Predicate<T>>getPredicates()the predicates the component needs to match, not null. final UnitsetPredicates(List<Predicate<T>> predicates)the predicates the component needs to match, not null. final StringgetThemes()if not null, the component must have all theme names defined. final UnitsetThemes(String themes)if not null, the component must have all theme names defined. final StringgetWithoutThemes()if not null, the component must NOT have any of the theme names defined. final UnitsetWithoutThemes(String withoutThemes)if not null, the component must NOT have any of the theme names defined. StringtoString()final UnitcaptionContains(String substring)Makes sure that the component's Component.caption contains given substring. final Function1<Component, Boolean>toPredicate()Returns a predicate which matches components based on this spec. -
-
Method Detail
-
getId
final String getId()
the required Component.getId; if null, no particular id is matched.
-
setId
final Unit setId(String id)
the required Component.getId; if null, no particular id is matched.
-
getCaption
final String getCaption()
the required Component.caption; if null, no particular caption is matched.
-
setCaption
final Unit setCaption(String caption)
the required Component.caption; if null, no particular caption is matched.
-
getPlaceholder
final String getPlaceholder()
the required Component.placeholder; if null, no particular placeholder is matched.
-
setPlaceholder
final Unit setPlaceholder(String placeholder)
the required Component.placeholder; if null, no particular placeholder is matched.
-
getCount
final IntRange getCount()
expected count of matching components, defaults to
0..Int.MAX_VALUE
-
setCount
final Unit setCount(IntRange count)
expected count of matching components, defaults to
0..Int.MAX_VALUE
-
getValue
final Object getValue()
expected com.vaadin.flow.component.HasValue.getValue; if
null, no particular value is matched.
-
setValue
final Unit setValue(Object value)
expected com.vaadin.flow.component.HasValue.getValue; if
null, no particular value is matched.
-
getClasses
final String getClasses()
if not null, the component must match all of these class names. Space-separated.
-
setClasses
final Unit setClasses(String classes)
if not null, the component must match all of these class names. Space-separated.
-
getWithoutClasses
final String getWithoutClasses()
if not null, the component must NOT match any of these class names. Space-separated.
-
setWithoutClasses
final Unit setWithoutClasses(String withoutClasses)
if not null, the component must NOT match any of these class names. Space-separated.
-
getPredicates
final List<Predicate<T>> getPredicates()
the predicates the component needs to match, not null. May be empty - in such case it is ignored. By default empty.
-
setPredicates
final Unit setPredicates(List<Predicate<T>> predicates)
the predicates the component needs to match, not null. May be empty - in such case it is ignored. By default empty.
-
getThemes
final String getThemes()
if not null, the component must have all theme names defined. Space-separated
-
setThemes
final Unit setThemes(String themes)
if not null, the component must have all theme names defined. Space-separated
-
getWithoutThemes
final String getWithoutThemes()
if not null, the component must NOT have any of the theme names defined. Space-separated
-
setWithoutThemes
final Unit setWithoutThemes(String withoutThemes)
if not null, the component must NOT have any of the theme names defined. Space-separated
-
captionContains
final Unit captionContains(String substring)
Makes sure that the component's Component.caption contains given substring.
-
toPredicate
final Function1<Component, Boolean> toPredicate()
Returns a predicate which matches components based on this spec. All rules are matched except the count rule. The rules are matched against given component only (not against its children).
-
-
-
-