Java Code Examples for com.tngtech.archunit.base.DescribedPredicate#apply()

The following examples show how to use com.tngtech.archunit.base.DescribedPredicate#apply() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RawAccessRecord.java    From ArchUnit with Apache License 2.0 5 votes vote down vote up
private static <T> Optional<T> tryFind(Iterable<T> collection, DescribedPredicate<? super T> predicate) {
    for (T elem : collection) {
        if (predicate.apply(elem)) {
            return Optional.of(elem);
        }
    }
    return Optional.absent();
}
 
Example 2
Source File: CanBeAnnotated.java    From ArchUnit with Apache License 2.0 5 votes vote down vote up
@PublicAPI(usage = ACCESS)
public static boolean isAnnotatedWith(
        Collection<? extends JavaAnnotation<?>> annotations,
        DescribedPredicate<? super JavaAnnotation<?>> predicate) {

    for (JavaAnnotation<?> annotation : annotations) {
        if (predicate.apply(annotation)) {
            return true;
        }
    }
    return false;
}
 
Example 3
Source File: JavaClass.java    From ArchUnit with Apache License 2.0 5 votes vote down vote up
private boolean anyMatches(List<JavaClass> possibleTargets, DescribedPredicate<? super JavaClass> predicate) {
    for (JavaClass javaClass : possibleTargets) {
        if (predicate.apply(javaClass)) {
            return true;
        }
    }
    return false;
}
 
Example 4
Source File: ThrowsClause.java    From ArchUnit with Apache License 2.0 5 votes vote down vote up
@PublicAPI(usage = ACCESS)
public boolean containsType(DescribedPredicate<? super JavaClass> predicate) {
    for (ThrowsDeclaration<?> throwsDeclaration : throwsDeclarations) {
        if (predicate.apply(throwsDeclaration.getRawType())) {
            return true;
        }
    }
    return false;
}