Class ByPredicate
java.lang.Object
com.dassault_systemes.modeler.kerml.find.AbstractFinder
com.dassault_systemes.modeler.kerml.find.ByPredicate
@OpenApiAll
public class ByPredicate
extends com.dassault_systemes.modeler.kerml.find.AbstractFinder
Finder implementation that locates
elements using a
custom predicate among directly owned elements.
This finder performs a non-recursive search and evaluates the provided
predicate against elements owned by the given context.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<T extends Element>
TFinds a single element matching the given predicate and type.Returns a stream of elements matching the given predicate and type.
-
Constructor Details
-
ByPredicate
public ByPredicate()
-
-
Method Details
-
find
Finds a single element matching the given predicate and type.- Overrides:
findin classcom.dassault_systemes.modeler.kerml.find.AbstractFinder- Type Parameters:
T- element type- Parameters:
context- the element whose direct owned elements are searchedtest- predicate used to filter elementsmetaclass- expected type of the result- Returns:
- the first matching element, or
nullif none found
-
streamOf
public <T extends Element> Stream<T> streamOf(Element context, Predicate<T> test, Class<T> metaclass) Returns a stream of elements matching the given predicate and type.- Overrides:
streamOfin classcom.dassault_systemes.modeler.kerml.find.AbstractFinder- Type Parameters:
T- element type- Parameters:
context- the element whose direct owned elements are searchedtest- predicate used to filter elementsmetaclass- expected element type- Returns:
- stream of matching elements (may be empty)
-