Interface PropertyHandler.ContainsHandler<Container,Element>

Type Parameters:
Container - The type of object that can contain elements.
Element - The type of object that can be contained.
All Superinterfaces:
PropertyHandler<Container>
Enclosing interface:
PropertyHandler<Type>

@Experimental public static interface PropertyHandler.ContainsHandler<Container,Element> extends PropertyHandler<Container>
A handler that can check if a container contains a specific element.
See Also:
  • Method Details

    • contains

      boolean contains(Container container, Element element)
      Checks if the given container contains the given element.
      Parameters:
      container - The container to check.
      element - The element to check for.
      Returns:
      true if the container contains the element, false otherwise.
    • elementTypes

      Class<? extends Element>[] elementTypes()
      The types of elements that can be contained. This is used for type checking and auto-completion. Implementations that override canContain(Class) may not return accurate results for this method. Callers should prefer canContain(Class) when possible.
      Returns:
      The types of elements that can be contained.
    • canContain

      default boolean canContain(Class<?> type)
      Checks if this handler can contain the given type of element. The default implementation checks if the given type is assignable to any of the types returned by elementTypes().
      Parameters:
      type - The type to check.
      Returns:
      true if this handler can contain the given type, false otherwise.