Interface GivenConjunction<OBJECTS>
- Type Parameters:
OBJECTS- The type of the objects to be checked by the finalArchRule, e.g.JavaClass.
- All Known Subinterfaces:
GivenClassesConjunction,GivenCodeUnitsConjunction<CODE_UNIT>,GivenConstructorsConjunction,GivenFieldsConjunction,GivenMembersConjunction<MEMBER>,GivenMethodsConjunction,GivenModulesByAnnotationConjunction<ANNOTATION>,GivenModulesConjunction<DESCRIPTOR>,GivenSlicesConjunction
Allows to further filter the set of all objects via
and(DescribedPredicate) or or(DescribedPredicate)
or create a complete ArchRule via should(ArchCondition).-
Method Summary
Modifier and TypeMethodDescriptionand(DescribedPredicate<? super OBJECTS> predicate) Combines the current predicate (e.g.or(DescribedPredicate<? super OBJECTS> predicate) Combines the current predicate (e.g.should(ArchCondition<? super OBJECTS> condition)
-
Method Details
-
should
- Parameters:
condition- TheArchConditionto check objects against- Returns:
- An
ArchRulethat can be checked against a set ofOBJECTS
-
and
@PublicAPI(usage=ACCESS) GivenConjunction<OBJECTS> and(DescribedPredicate<? super OBJECTS> predicate) Combines the current predicate (e.g.simpleName== 'SomeClass') with another predicate (e.g.resideInAPackage'foo.bar') using AND (i.e. both predicates must be satisfied).
NOTE:
and(DescribedPredicate)andor(DescribedPredicate)combine predicates in the sequence they are declared, without any "operator precedence". I.e.
all(objects()).that(predicateA).or(predicateB).and(predicateC)...will filter on predicate
(predicateA || predicateB) && predicateC, and
all(objects()).that(predicateA).and(predicateB).or(predicateC)...will filter on predicate
(predicateA && predicateB) || predicateC. If you need more control over the precedence, how predicates are joined, you have to join these predicates separately, i.e.
all(objects()).that(predicateA.or(predicateB.and(predicateC)))...- Parameters:
predicate- The predicate to be ANDed on the current object filter predicate- Returns:
- A syntax conjunction element, which can be completed to form a full rule
-
or
@PublicAPI(usage=ACCESS) GivenConjunction<OBJECTS> or(DescribedPredicate<? super OBJECTS> predicate) Combines the current predicate (e.g.simpleName== 'SomeClass') with another predicate (e.g.resideInAPackage'foo.bar') using OR (i.e. at least one of the predicates must be satisfied).
NOTE: For considerations about precedence, when joining predicates, consider note at
and(DescribedPredicate)- Parameters:
predicate- The predicate to be ORed on the current object filter predicate- Returns:
- A syntax conjunction element, which can be completed to form a full rule
-