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:
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.skriptlang.skript.lang.properties.PropertyHandler
PropertyHandler.ConditionPropertyHandler<Type>, PropertyHandler.ContainsHandler<Container,
Element>, PropertyHandler.ExpressionPropertyHandler<Type, ReturnType>, PropertyHandler.TypedValuePropertyHandler<Type, ValueType> -
Method Summary
Modifier and TypeMethodDescriptiondefault boolean
canContain
(Class<?> type) Checks if this handler can contain the given type of element.boolean
Checks if the given container contains the given element.The types of elements that can be contained.Methods inherited from interface org.skriptlang.skript.lang.properties.PropertyHandler
init, newInstance
-
Method Details
-
contains
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
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:
true
if this handler can contain the given type,false
otherwise.
-