Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support creation of arbitrary ArchConditions from Predicates #855

Open
u3r opened this issue Apr 27, 2022 · 0 comments
Open

Support creation of arbitrary ArchConditions from Predicates #855

u3r opened this issue Apr 27, 2022 · 0 comments

Comments

@u3r
Copy link
Contributor

u3r commented Apr 27, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant