diff --git a/archunit/src/main/java/com/tngtech/archunit/core/domain/properties/CanBeAnnotated.java b/archunit/src/main/java/com/tngtech/archunit/core/domain/properties/CanBeAnnotated.java index 9a21d67350..b87748717a 100644 --- a/archunit/src/main/java/com/tngtech/archunit/core/domain/properties/CanBeAnnotated.java +++ b/archunit/src/main/java/com/tngtech/archunit/core/domain/properties/CanBeAnnotated.java @@ -35,21 +35,60 @@ import static com.tngtech.archunit.core.domain.properties.HasType.Functions.GET_RAW_TYPE; public interface CanBeAnnotated { + + /** + * Returns {@code true}, if this element is annotated with the given annotation type. + * + * @param annotationType The type of the annotation to check for + */ @PublicAPI(usage = ACCESS) boolean isAnnotatedWith(Class extends Annotation> annotationType); + /** + * @param annotationTypeName Fully qualified class name of a specific type of {@link Annotation} + * @see #isAnnotatedWith(Class) + */ @PublicAPI(usage = ACCESS) boolean isAnnotatedWith(String annotationTypeName); + /** + * Returns {@code true}, if this element is annotated with an annotation matching the given predicate. + * + * @param predicate Qualifies matching annotations + */ @PublicAPI(usage = ACCESS) boolean isAnnotatedWith(DescribedPredicate super JavaAnnotation>> predicate); + /** + * Returns {@code true}, if this element is meta-annotated with the given annotation type. + * A meta-annotation is an annotation that is declared on another annotation. + * + *
+ * This method also returns {@code true} if this element is directly annotated with the given annotation type. + *
+ * + * @param annotationType The type of the annotation to check for + */ @PublicAPI(usage = ACCESS) boolean isMetaAnnotatedWith(Class extends Annotation> annotationType); + /** + * @param annotationTypeName Fully qualified class name of a specific type of {@link Annotation} + * @see #isMetaAnnotatedWith(Class) + */ @PublicAPI(usage = ACCESS) boolean isMetaAnnotatedWith(String annotationTypeName); + /** + * Returns {@code true}, if this element is meta-annotated with an annotation matching the given predicate. + * A meta-annotation is an annotation that is declared on another annotation. + * + *+ * This method also returns {@code true} if this element is directly annotated with an annotation matching the given predicate. + *
+ * + * @param predicate Qualifies matching annotations + */ @PublicAPI(usage = ACCESS) boolean isMetaAnnotatedWith(DescribedPredicate super JavaAnnotation>> predicate); @@ -57,6 +96,11 @@ final class Predicates { private Predicates() { } + /** + * Returns a predicate that matches elements that are annotated with the given annotation type. + * + * @param annotationType The type of the annotation to check for + */ @PublicAPI(usage = ACCESS) public static DescribedPredicate+ * The returned predicate also matches elements that are directly annotated with the given annotation type. + *
+ * + * @param annotationType The type of the annotation to check for + */ @PublicAPI(usage = ACCESS) public static DescribedPredicate+ * The returned predicate also matches elements that are directly annotated with the given annotation type. + *
+ * + * @param predicate Qualifies matching annotations + */ @PublicAPI(usage = ACCESS) public static DescribedPredicate+ * The assertion is also successful if classes are directly annotated with the supplied annotation type. + *
+ * * @param annotationType Specific type of {@link Annotation} * @return A syntax element that can either be used as working rule, or to continue specifying a more complex rule */ @@ -352,6 +356,10 @@ public interface ClassesShould { * Asserts that classes are not meta-annotated with a certain type of annotation. A meta-annotation is * an annotation that is declared on another annotation. * + *+ * The assertion also fails if classes are directly annotated with the supplied annotation type. + *
+ * * @param annotationType Specific type of {@link Annotation} * @return A syntax element that can either be used as working rule, or to continue specifying a more complex rule */ @@ -362,6 +370,10 @@ public interface ClassesShould { * Asserts that classes are meta-annotated with a certain type of annotation. A meta-annotation is * an annotation that is declared on another annotation. * + *+ * The assertion is also successful if classes are directly annotated with the supplied annotation type. + *
+ * * @param annotationTypeName Fully qualified class name of a specific type of {@link Annotation} * @return A syntax element that can either be used as working rule, or to continue specifying a more complex rule */ @@ -372,6 +384,10 @@ public interface ClassesShould { * Asserts that classes are not meta-annotated with a certain type of annotation. A meta-annotation is * an annotation that is declared on another annotation. * + *+ * The assertion also fails if classes are directly annotated with the supplied annotation type. + *
+ * * @param annotationTypeName Fully qualified class name of a specific type of {@link Annotation} * @return A syntax element that can either be used as working rule, or to continue specifying a more complex rule */ @@ -382,6 +398,10 @@ public interface ClassesShould { * Asserts that classes are meta-annotated with a certain annotation, where matching meta-annotations are * determined by the supplied predicate. A meta-annotation is an annotation that is declared on another annotation. * + *+ * The assertion is also successful if classes are directly annotated with an annotation matching the supplied predicate. + *
+ * * @param predicate A predicate defining matching {@link JavaAnnotation JavaAnnotations} * @return A syntax element that can either be used as working rule, or to continue specifying a more complex rule */ @@ -392,6 +412,10 @@ public interface ClassesShould { * Asserts that classes are not meta-annotated with a certain annotation, where matching meta-annotations are * determined by the supplied predicate. A meta-annotation is an annotation that is declared on another annotation. * + *+ * The assertion also fails if classes are directly annotated with an annotation matching the supplied predicate. + *
+ * * @param predicate A predicate defining matching {@link JavaAnnotation JavaAnnotations} * @return A syntax element that can either be used as working rule, or to continue specifying a more complex rule */ diff --git a/archunit/src/main/java/com/tngtech/archunit/lang/syntax/elements/ClassesThat.java b/archunit/src/main/java/com/tngtech/archunit/lang/syntax/elements/ClassesThat.java index bbf656c5bc..34c5970c70 100644 --- a/archunit/src/main/java/com/tngtech/archunit/lang/syntax/elements/ClassesThat.java +++ b/archunit/src/main/java/com/tngtech/archunit/lang/syntax/elements/ClassesThat.java @@ -318,6 +318,10 @@ public interface ClassesThat+ * This also matches classes that are directly annotated with the supplied annotation type. + *
+ * * @param annotationType Specific type of {@link Annotation} * @return A syntax conjunction element, which can be completed to form a full rule */ @@ -328,6 +332,10 @@ public interface ClassesThat+ * Matching classes may also not directly be annotated with the supplied annotation type. + *
+ * * @param annotationType Specific type of {@link Annotation} * @return A syntax conjunction element, which can be completed to form a full rule */ @@ -338,6 +346,10 @@ public interface ClassesThat+ * This also matches classes that are directly annotated with the supplied annotation type. + *
+ * * @param annotationTypeName Fully qualified class name of a specific type of {@link Annotation} * @return A syntax conjunction element, which can be completed to form a full rule */ @@ -348,6 +360,10 @@ public interface ClassesThat+ * Matching classes may also not directly be annotated with the supplied annotation type. + *
+ * * @param annotationTypeName Fully qualified class name of a specific type of {@link Annotation} * @return A syntax conjunction element, which can be completed to form a full rule */ @@ -359,6 +375,10 @@ public interface ClassesThat+ * This also matches classes where a direct annotation matches the supplied predicate. + *
+ * * @param predicate A predicate defining matching {@link JavaAnnotation JavaAnnotations} * @return A syntax conjunction element, which can be completed to form a full rule */ @@ -370,6 +390,10 @@ public interface ClassesThat+ * Matching classes may also not be annotated with a direct annotation matching the supplied predicate. + *
+ * * @param predicate A predicate defining matching {@link JavaAnnotation JavaAnnotations} * @return A syntax conjunction element, which can be completed to form a full rule */ diff --git a/archunit/src/main/java/com/tngtech/archunit/lang/syntax/elements/MembersShould.java b/archunit/src/main/java/com/tngtech/archunit/lang/syntax/elements/MembersShould.java index 5a9da4f818..92ea05df23 100644 --- a/archunit/src/main/java/com/tngtech/archunit/lang/syntax/elements/MembersShould.java +++ b/archunit/src/main/java/com/tngtech/archunit/lang/syntax/elements/MembersShould.java @@ -299,6 +299,10 @@ public interface MembersShould+ * The assertion is also successful if members are directly annotated with the supplied annotation type. + *
+ * * @param annotationType Specific type of {@link Annotation} * @return A syntax element that can either be used as working rule, or to continue specifying a more complex rule */ @@ -309,6 +313,10 @@ public interface MembersShould+ * The assertion also fails if members are directly annotated with the supplied annotation type. + *
+ * * @param annotationType Specific type of {@link Annotation} * @return A syntax element that can either be used as working rule, or to continue specifying a more complex rule */ @@ -319,6 +327,10 @@ public interface MembersShould+ * The assertion is also successful if members are directly annotated with the supplied annotation type. + *
+ * * @param annotationTypeName Fully qualified class name of a specific type of {@link Annotation} * @return A syntax element that can either be used as working rule, or to continue specifying a more complex rule */ @@ -329,6 +341,10 @@ public interface MembersShould+ * The assertion also fails if members are directly annotated with the supplied annotation type. + *
+ * * @param annotationTypeName Fully qualified class name of a specific type of {@link Annotation} * @return A syntax element that can either be used as working rule, or to continue specifying a more complex rule */ @@ -339,6 +355,10 @@ public interface MembersShould+ * The assertion is also successful if members are directly annotated with an annotation matching the supplied predicate. + *
+ * * @param predicate A predicate defining matching {@link JavaAnnotation JavaAnnotations} * @return A syntax element that can either be used as working rule, or to continue specifying a more complex rule */ @@ -349,6 +369,10 @@ public interface MembersShould+ * The assertion also fails if members are directly annotated with an annotation matching the supplied predicate. + *
+ * * @param predicate A predicate defining matching {@link JavaAnnotation JavaAnnotations} * @return A syntax element that can either be used as working rule, or to continue specifying a more complex rule */ diff --git a/archunit/src/main/java/com/tngtech/archunit/lang/syntax/elements/MembersThat.java b/archunit/src/main/java/com/tngtech/archunit/lang/syntax/elements/MembersThat.java index c099751527..1e8370e634 100644 --- a/archunit/src/main/java/com/tngtech/archunit/lang/syntax/elements/MembersThat.java +++ b/archunit/src/main/java/com/tngtech/archunit/lang/syntax/elements/MembersThat.java @@ -297,6 +297,10 @@ public interface MembersThat+ * This also matches members that are directly annotated with the supplied annotation type. + *
+ * * @param annotationType Specific type of {@link Annotation} * @return A syntax conjunction element, which can be completed to form a full rule */ @@ -307,6 +311,10 @@ public interface MembersThat+ * Matching members may also not directly be annotated with the supplied annotation type. + *
+ * * @param annotationType Specific type of {@link Annotation} * @return A syntax conjunction element, which can be completed to form a full rule */ @@ -317,6 +325,10 @@ public interface MembersThat+ * This also matches members that are directly annotated with the supplied annotation type. + *
+ * * @param annotationTypeName Fully qualified class name of a specific type of {@link Annotation} * @return A syntax conjunction element, which can be completed to form a full rule */ @@ -327,6 +339,10 @@ public interface MembersThat+ * Matching members may also not directly be annotated with the supplied annotation type. + *
+ * * @param annotationTypeName Fully qualified class name of a specific type of {@link Annotation} * @return A syntax conjunction element, which can be completed to form a full rule */ @@ -338,6 +354,10 @@ public interface MembersThat+ * This also matches members where a direct annotation matches the supplied predicate. + *
+ * * @param predicate A predicate defining matching {@link JavaAnnotation JavaAnnotations} * @return A syntax conjunction element, which can be completed to form a full rule */ @@ -349,6 +369,10 @@ public interface MembersThat+ * Matching members may also not be annotated with a direct annotation matching the supplied predicate. + *
+ * * @param predicate A predicate defining matching {@link JavaAnnotation JavaAnnotations} * @return A syntax conjunction element, which can be completed to form a full rule */