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 Details

    • ByPredicate

      public ByPredicate()
  • Method Details

    • find

      public <T extends Element> T find(Element context, Predicate<T> test, Class<T> metaclass)
      Finds a single element matching the given predicate and type.
      Overrides:
      find in class com.dassault_systemes.modeler.kerml.find.AbstractFinder
      Type Parameters:
      T - element type
      Parameters:
      context - the element whose direct owned elements are searched
      test - predicate used to filter elements
      metaclass - expected type of the result
      Returns:
      the first matching element, or null if 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:
      streamOf in class com.dassault_systemes.modeler.kerml.find.AbstractFinder
      Type Parameters:
      T - element type
      Parameters:
      context - the element whose direct owned elements are searched
      test - predicate used to filter elements
      metaclass - expected element type
      Returns:
      stream of matching elements (may be empty)