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

The following examples show how to use com.tngtech.archunit.base.DescribedPredicate#forSubType() . 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: PredicateAggregator.java    From ArchUnit with Apache License 2.0 5 votes vote down vote up
static <T> AddMode<T> and() {
    return new AddMode<T>() {
        @Override
        DescribedPredicate<T> apply(Optional<DescribedPredicate<T>> first, DescribedPredicate<? super T> other) {
            DescribedPredicate<T> second = other.forSubType();
            return first.isPresent() ? first.get().and(second) : second;
        }
    };
}
 
Example 2
Source File: PredicateAggregator.java    From ArchUnit with Apache License 2.0 5 votes vote down vote up
static <T> AddMode<T> or() {
    return new AddMode<T>() {
        @Override
        DescribedPredicate<T> apply(Optional<DescribedPredicate<T>> first, DescribedPredicate<? super T> other) {
            DescribedPredicate<T> second = other.forSubType();
            return first.isPresent() ? first.get().or(second) : second;
        }
    };
}
 
Example 3
Source File: ArchConditions.java    From ArchUnit with Apache License 2.0 4 votes vote down vote up
NumberOfElementsCondition(DescribedPredicate<? super Integer> predicate) {
    super("contain number of elements " + predicate.getDescription());
    this.predicate = predicate.forSubType();
    allClassNames = new TreeSet<>();
}
 
Example 4
Source File: ArchConditions.java    From ArchUnit with Apache License 2.0 4 votes vote down vote up
IsConditionByPredicate(String eventDescription, DescribedPredicate<? super T> predicate) {
    super(ArchPredicates.be(predicate).getDescription());
    this.eventDescription = eventDescription;
    this.predicate = predicate.forSubType();
}
 
Example 5
Source File: ArchConditions.java    From ArchUnit with Apache License 2.0 4 votes vote down vote up
HaveConditionByPredicate(DescribedPredicate<? super T> rawType) {
    super(ArchPredicates.have(rawType).getDescription());
    this.rawType = rawType.forSubType();
}
 
Example 6
Source File: Architectures.java    From ArchUnit with Apache License 2.0 4 votes vote down vote up
@PublicAPI(usage = ACCESS)
public LayeredArchitecture definedBy(DescribedPredicate<? super JavaClass> predicate) {
    checkNotNull(predicate, "Supplied predicate must not be null");
    this.containsPredicate = predicate.forSubType();
    return LayeredArchitecture.this.addLayerDefinition(this);
}