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

The following examples show how to use com.tngtech.archunit.base.DescribedPredicate#getDescription() . 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: AbstractClassesTransformer.java    From ArchUnit with Apache License 2.0 5 votes vote down vote up
@Override
public final ClassesTransformer<T> that(final DescribedPredicate<? super T> predicate) {
    return new AbstractClassesTransformer<T>(description + " that " + predicate.getDescription()) {
        @Override
        public Iterable<T> doTransform(JavaClasses collection) {
            Iterable<T> transformed = AbstractClassesTransformer.this.doTransform(collection);
            return Guava.Iterables.filter(transformed, predicate);
        }
    };
}
 
Example 2
Source File: ArchConditions.java    From ArchUnit with Apache License 2.0 5 votes vote down vote up
@PublicAPI(usage = ACCESS)
public static ArchCondition<JavaClass> dependOnClassesThat(final DescribedPredicate<? super JavaClass> predicate) {
    return new AnyDependencyCondition(
            "depend on classes that " + predicate.getDescription(),
            GET_TARGET_CLASS.is(predicate),
            GET_DIRECT_DEPENDENCIES_FROM_SELF);
}
 
Example 3
Source File: ArchConditions.java    From ArchUnit with Apache License 2.0 5 votes vote down vote up
@PublicAPI(usage = ACCESS)
public static ArchCondition<JavaClass> onlyDependOnClassesThat(final DescribedPredicate<? super JavaClass> predicate) {
    return new AllDependenciesCondition(
            "only depend on classes that " + predicate.getDescription(),
            GET_TARGET_CLASS.is(predicate),
            GET_DIRECT_DEPENDENCIES_FROM_SELF);
}
 
Example 4
Source File: ArchConditions.java    From ArchUnit with Apache License 2.0 4 votes vote down vote up
SimpleNameStartingWithCondition(DescribedPredicate<JavaClass> predicate, String prefix) {
    super(predicate.getDescription());
    this.predicate = predicate;
    this.prefix = prefix;
}
 
Example 5
Source File: ArchConditions.java    From ArchUnit with Apache License 2.0 4 votes vote down vote up
IsConditionByPredicate(DescribedPredicate<? super T> predicate) {
    this(predicate.getDescription(), predicate);
}
 
Example 6
Source File: HasThrowsClause.java    From ArchUnit with Apache License 2.0 4 votes vote down vote up
ThrowsTypesPredicate(DescribedPredicate<? super ThrowsClause<?>> predicate) {
    super("throws types " + predicate.getDescription());
    this.predicate = predicate;
}
 
Example 7
Source File: JavaFieldAccess.java    From ArchUnit with Apache License 2.0 4 votes vote down vote up
TargetPredicate(DescribedPredicate<? super FieldAccessTarget> predicate) {
    super("target " + predicate.getDescription());
    this.predicate = predicate;
}
 
Example 8
Source File: ArchConditions.java    From ArchUnit with Apache License 2.0 4 votes vote down vote up
ContainingCondition(DescribedPredicate<T> containing, String infix) {
    super(containing.getDescription());
    this.containing = containing;
    this.infix = infix;
}
 
Example 9
Source File: ArchConditions.java    From ArchUnit with Apache License 2.0 4 votes vote down vote up
StartingCondition(DescribedPredicate<T> startingWith, String prefix) {
    super(startingWith.getDescription());
    this.startingWith = startingWith;
    this.prefix = prefix;
}
 
Example 10
Source File: ArchConditions.java    From ArchUnit with Apache License 2.0 4 votes vote down vote up
MatchingCondition(DescribedPredicate<T> matcher, String regex) {
    super(matcher.getDescription());
    this.matcher = matcher;
    this.regex = regex;
}
 
Example 11
Source File: JavaAccess.java    From ArchUnit with Apache License 2.0 4 votes vote down vote up
TargetPredicate(DescribedPredicate<? super AccessTarget> predicate) {
    super("target " + predicate.getDescription());
    this.predicate = predicate;
}
 
Example 12
Source File: ArchConditions.java    From ArchUnit with Apache License 2.0 4 votes vote down vote up
SimpleNameContainingCondition(DescribedPredicate<JavaClass> predicate, String infix) {
    super(predicate.getDescription());
    this.predicate = predicate;
    this.infix = infix;
}
 
Example 13
Source File: CanBeAnnotated.java    From ArchUnit with Apache License 2.0 4 votes vote down vote up
MetaAnnotatedPredicate(DescribedPredicate<? super JavaAnnotation<?>> predicate) {
    super("meta-annotated with " + predicate.getDescription());
    this.predicate = predicate;
}
 
Example 14
Source File: ArchConditions.java    From ArchUnit with Apache License 2.0 4 votes vote down vote up
SimpleNameCondition(DescribedPredicate<JavaClass> haveSimpleName, String name) {
    super(haveSimpleName.getDescription());
    this.haveSimpleName = haveSimpleName;
    this.name = name;
}
 
Example 15
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 16
Source File: HasOwner.java    From ArchUnit with Apache License 2.0 4 votes vote down vote up
OwnerPredicate(DescribedPredicate<? super T> predicate) {
    super("owner " + predicate.getDescription());
    this.predicate = predicate;
}
 
Example 17
Source File: CanBeAnnotated.java    From ArchUnit with Apache License 2.0 4 votes vote down vote up
AnnotatedPredicate(DescribedPredicate<? super JavaAnnotation<?>> predicate) {
    super("annotated with " + predicate.getDescription());
    this.predicate = predicate;
}
 
Example 18
Source File: ArchConditions.java    From ArchUnit with Apache License 2.0 4 votes vote down vote up
/**
 * @param predicate A predicate specifying allowed dependencies on this class
 * @return A condition satisfied by {@link JavaClass classes} where all {@link Dependency dependencies}
 * on them (e.g. calling methods of this class) are matched by the predicate
 */
@PublicAPI(usage = ACCESS)
public static ArchCondition<JavaClass> onlyHaveDependentsWhere(DescribedPredicate<? super Dependency> predicate) {
    String description = "only have dependents where " + predicate.getDescription();
    return new AllDependenciesCondition(description, predicate, GET_DIRECT_DEPENDENCIES_TO_SELF);
}
 
Example 19
Source File: DependencyCondition.java    From ArchUnit with Apache License 2.0 4 votes vote down vote up
DependencyCondition(DescribedPredicate<? super Dependency> conditionPredicate) {
    super(conditionPredicate.getDescription());
    this.conditionPredicate = conditionPredicate;
}
 
Example 20
Source File: JavaAccessCondition.java    From ArchUnit with Apache License 2.0 4 votes vote down vote up
JavaAccessCondition(DescribedPredicate<? super T> predicate) {
    super("access target where " + predicate.getDescription());
    this.predicate = predicate;
}