public class Predicates extends Object
NOTE: it is recommended to use methods that accept fully qualified class names instead of
Class
objects to reduce the risks of introducing circular dependencies between the
project submodules.
Modifier and Type | Method and Description |
---|---|
static com.tngtech.archunit.base.DescribedPredicate<com.tngtech.archunit.core.domain.JavaClass> |
areDirectlyAnnotatedWithAtLeastOneOf(Class<? extends Annotation>... annotations) |
static com.tngtech.archunit.base.DescribedPredicate<com.tngtech.archunit.core.domain.JavaField> |
areFieldOfType(String fqClassName,
com.tngtech.archunit.core.domain.JavaModifier... modifiers)
Tests that the field has the fully qualified type of
fqClassName with the given
modifiers. |
static com.tngtech.archunit.base.DescribedPredicate<com.tngtech.archunit.core.domain.JavaField> |
arePublicFinalOfType(String fqClassName)
Tests that the given field is
public final , not static and has the given
fully qualified type name of fqClassName . |
static com.tngtech.archunit.base.DescribedPredicate<com.tngtech.archunit.core.domain.JavaField> |
arePublicFinalOfTypeWithAnnotation(String fqClassName,
Class<? extends Annotation> annotationType)
Tests that the field is
public final , has the fully qualified type name of fqClassName and is annotated with the annotationType . |
static com.tngtech.archunit.base.DescribedPredicate<com.tngtech.archunit.core.domain.JavaField> |
arePublicStaticFinalAssignableTo(Class<?> clazz)
Tests that the given field is
public static final and is assignable to the given type
clazz . |
static com.tngtech.archunit.base.DescribedPredicate<com.tngtech.archunit.core.domain.JavaField> |
arePublicStaticFinalOfType(String fqClassName)
Tests that the field is
public static final and has the fully qualified type name of
fqClassName . |
static com.tngtech.archunit.base.DescribedPredicate<com.tngtech.archunit.core.domain.JavaField> |
arePublicStaticFinalOfTypeWithAnnotation(String fqClassName,
Class<? extends Annotation> annotationType)
Tests that the field is
public static final , has the fully qualified type name of
fqClassName and is annotated with the annotationType . |
static com.tngtech.archunit.base.DescribedPredicate<com.tngtech.archunit.core.domain.JavaField> |
arePublicStaticOfType(String fqClassName)
Tests that the given field is
public static and has the fully qualified type name of
fqClassName . |
static com.tngtech.archunit.base.DescribedPredicate<com.tngtech.archunit.core.domain.JavaField> |
areStaticFinalOfTypeWithAnnotation(String fqClassName,
Class<? extends Annotation> annotationType)
Tests that the field is
static final , has the fully qualified type name of fqClassName and is annotated with the annotationType . |
static com.tngtech.archunit.base.DescribedPredicate<com.tngtech.archunit.core.domain.JavaClass> |
containAnyFieldsInClassHierarchyThat(com.tngtech.archunit.base.DescribedPredicate<? super com.tngtech.archunit.core.domain.JavaField> predicate) |
static <T> com.tngtech.archunit.base.DescribedPredicate<T> |
exactlyOneOf(com.tngtech.archunit.base.DescribedPredicate<? super T>... other)
Returns a
DescribedPredicate that returns true if one and only one of the given
predicates match. |
static String |
getClassSimpleNameFromFqName(String fqClassName)
Extracts the class name from the given fully qualified class name.
|
@SafeVarargs public static com.tngtech.archunit.base.DescribedPredicate<com.tngtech.archunit.core.domain.JavaClass> areDirectlyAnnotatedWithAtLeastOneOf(Class<? extends Annotation>... annotations)
public static com.tngtech.archunit.base.DescribedPredicate<com.tngtech.archunit.core.domain.JavaClass> containAnyFieldsInClassHierarchyThat(com.tngtech.archunit.base.DescribedPredicate<? super com.tngtech.archunit.core.domain.JavaField> predicate)
DescribedPredicate
returning true, if and only if the predicate JavaField
could be found in the JavaClass
.public static com.tngtech.archunit.base.DescribedPredicate<com.tngtech.archunit.core.domain.JavaField> arePublicStaticOfType(String fqClassName)
public static
and has the fully qualified type name of
fqClassName
.
Attention: changing the description will add a rule into the stored.rules.
public static com.tngtech.archunit.base.DescribedPredicate<com.tngtech.archunit.core.domain.JavaField> areFieldOfType(String fqClassName, com.tngtech.archunit.core.domain.JavaModifier... modifiers)
fqClassName
with the given
modifiers.
Attention: changing the description will add a rule into the stored.rules.
public static com.tngtech.archunit.base.DescribedPredicate<com.tngtech.archunit.core.domain.JavaField> arePublicFinalOfType(String fqClassName)
public final
, not static
and has the given
fully qualified type name of fqClassName
.public static com.tngtech.archunit.base.DescribedPredicate<com.tngtech.archunit.core.domain.JavaField> arePublicStaticFinalAssignableTo(Class<?> clazz)
public static final
and is assignable to the given type
clazz
.public static com.tngtech.archunit.base.DescribedPredicate<com.tngtech.archunit.core.domain.JavaField> arePublicStaticFinalOfType(String fqClassName)
public static final
and has the fully qualified type name of
fqClassName
.public static com.tngtech.archunit.base.DescribedPredicate<com.tngtech.archunit.core.domain.JavaField> arePublicFinalOfTypeWithAnnotation(String fqClassName, Class<? extends Annotation> annotationType)
public final
, has the fully qualified type name of fqClassName
and is annotated with the annotationType
.public static com.tngtech.archunit.base.DescribedPredicate<com.tngtech.archunit.core.domain.JavaField> arePublicStaticFinalOfTypeWithAnnotation(String fqClassName, Class<? extends Annotation> annotationType)
public static final
, has the fully qualified type name of
fqClassName
and is annotated with the annotationType
.public static com.tngtech.archunit.base.DescribedPredicate<com.tngtech.archunit.core.domain.JavaField> areStaticFinalOfTypeWithAnnotation(String fqClassName, Class<? extends Annotation> annotationType)
static final
, has the fully qualified type name of fqClassName
and is annotated with the annotationType
. It doesn't matter if public,
private or protected.@SafeVarargs public static <T> com.tngtech.archunit.base.DescribedPredicate<T> exactlyOneOf(com.tngtech.archunit.base.DescribedPredicate<? super T>... other)
DescribedPredicate
that returns true if one and only one of the given
predicates match.Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.