Interface 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>
@Experimental
public interface ContainsHandler<Container, Element>
extends PropertyHandler<Container>
A handler that can check if a container contains a specific element.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptiondefault booleancanContain(Class<?> type) Checks if this handler can contain the given type of element.booleanChecks if the given container contains the given element.The types of elements that can be contained.Methods inherited from interface PropertyHandler
init, newInstance
-
Method Details
-
contains
-
elementTypes
The types of elements that can be contained. This is used for type checking and auto-completion. Implementations that overridecanContain(Class)may not return accurate results for this method. Callers should prefercanContain(Class)when possible.- Returns:
- The types of elements that can be contained.
-
canContain
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 byelementTypes().- Parameters:
type- The type to check.- Returns:
trueif this handler can contain the given type,falseotherwise.
-