Class EntityPredicate.Builder
java.lang.Object
com.github.darksoulq.abyssallib.world.entity.EntityPredicate.Builder
- Enclosing class:
EntityPredicate
A fluent builder pattern class designed to easily construct
EntityPredicate instances.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()Finalizes construction and returns the built EntityPredicate.check(Condition<EntityPredicate> condition) Adds a nested predicate condition.check(EntityPredicate predicate) Evaluates a sub-predicate against the entity.checkAny(EntityPredicate... predicates) Requires the entity to satisfy at least one of the provided sub-predicates.Adds an exact value-matching condition against the entity's serialized JSON data.Requires an exact match for a specific key-value pair within the entity's data.final EntityPredicate.BuilderRequires the entity to match at least one of the provided key-value data entries.id(net.kyori.adventure.key.Key id) Mandates that the entity matches a specific identity Key.
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
id
Mandates that the entity matches a specific identity Key.- Parameters:
id- TheKeyto match.- Returns:
- This builder instance.
-
data
public EntityPredicate.Builder data(Condition<Map.Entry<String, com.fasterxml.jackson.databind.JsonNode>> condition) Adds an exact value-matching condition against the entity's serialized JSON data.- Parameters:
condition- TheConditionwrapping a JSON node entry.- Returns:
- This builder instance.
-
check
Adds a nested predicate condition.- Parameters:
condition- TheConditionwrapping a nested entity predicate.- Returns:
- This builder instance.
-
data
Requires an exact match for a specific key-value pair within the entity's data.- Parameters:
key- The JSON key to inspect.value- The expected value object to match against.- Returns:
- This builder instance.
-
check
Evaluates a sub-predicate against the entity.- Parameters:
predicate- The nestedEntityPredicateto test.- Returns:
- This builder instance.
-
dataAny
Requires the entity to match at least one of the provided key-value data entries.- Parameters:
entries- The varargs array of map entries to check.- Returns:
- This builder instance.
-
checkAny
Requires the entity to satisfy at least one of the provided sub-predicates.- Parameters:
predicates- The varargs array of nestedEntityPredicates to check.- Returns:
- This builder instance.
-
build
Finalizes construction and returns the built EntityPredicate.- Returns:
- The configured
EntityPredicateinstance.
-