Support creation of arbitrary ArchConditions from Predicates #855
Open
Description
Hi everyone,
internally there are already DoesConditionByPredicate, IsConditionByPredicate, HaveConditionByPredicate
.
What is missing is access to them, e.g. in the form of
// ArchCondition.java
public <T extends HasDescription & HasSourceCodeLocation> ArchCondition<T> have( DescribedPredicate<T> predicate ) {
return new HaveConditionByPredicate(predicate);
}
public <T extends HasDescription & HasSourceCodeLocation> ArchCondition<T> is( DescribedPredicate<T> predicate ) {
return new IsConditionByPredicate(predicate);
}
public <T extends HasDescription & HasSourceCodeLocation> ArchCondition<T> does( DescribedPredicate<T> predicate ) {
return new DoesConditionByPredicate(predicate);
}
as well as the respective shortcuts in
ClassesShould, ClassesShouldConjuntion, MethodsShould, MethodsShouldConjunction ....
e.g.
/*IsConditionByPredicate*/ ClassesShould.be(DescribedPredicate<T> predicate)
/*HaveConditionByPredicate*/ ClassesShould.have(DescribedPredicate<T> predicate)
this would make writing own Archrules (by using mainly predicates) so much easier and more general.
Metadata
Assignees
Labels
No labels