java.lang.Object
com.dassault_systemes.modeler.kerml.find.AbstractFinder
com.dassault_systemes.modeler.kerml.find.ByName

@OpenApiAll public class ByName extends com.dassault_systemes.modeler.kerml.find.AbstractFinder
Finder utility for locating a directly owned Element by its name.

The search is limited to Elements that are directly owned by the supplied context Element. The first matching element of the requested metaclass is returned, or null if no such element exists.

  • Constructor Details

    • ByName

      public ByName()
  • Method Details

    • find

      @CheckForNull public <T extends Element> T find(Element context, String name, Class<T> metaclass)
      Finds the first directly owned Element of the given metaclass whose name is equal to the specified name.
      Type Parameters:
      T - the specific Element subtype that should be returned
      Parameters:
      context - the Element whose directly owned Elements are searched;
      name - the expected name of the Element to find;
      metaclass - the concrete Class of Element to search for; only instances of this type are considered
      Returns:
      the first directly owned Element of type T whose name equals name, or null if no such Element exists