Interface ClassesThat<CONJUNCTION>
public interface ClassesThat<CONJUNCTION>
-
Method Summary
Modifier and TypeMethodDescriptionareAnnotatedWith
(DescribedPredicate<? super JavaAnnotation<?>> predicate) Matches classes annotated with a certain annotation, where matching annotations are determined by the supplied predicate.areAnnotatedWith
(Class<? extends Annotation> annotationType) Matches classes annotated with a certain type of annotation.areAnnotatedWith
(String annotationTypeName) Matches classes annotated with a certain type of annotation.Matches annotations.areAssignableFrom
(DescribedPredicate<? super JavaClass> predicate) Matches classes assignable from a certain type matching the given predicate.areAssignableFrom
(Class<?> type) Matches classes assignable from a certain type (compareClass.isAssignableFrom(Class)
to terminology).areAssignableFrom
(String typeName) Matches classes assignable from a certain type with the given type name.areAssignableTo
(DescribedPredicate<? super JavaClass> predicate) Matches classes assignable to a certain type matching the given predicate.areAssignableTo
(Class<?> type) Matches classes assignable to a certain type (compareClass.isAssignableFrom(Class)
to terminology).areAssignableTo
(String typeName) Matches classes assignable to a certain type with the given type name.areEnums()
Matches enums.Matches interfaces.areMetaAnnotatedWith
(DescribedPredicate<? super JavaAnnotation<?>> predicate) Matches classes meta-annotated with a certain annotation, where matching meta-annotations are determined by the supplied predicate.areMetaAnnotatedWith
(Class<? extends Annotation> annotationType) Matches classes meta-annotated with a certain type of annotation.areMetaAnnotatedWith
(String annotationTypeName) Matches classes meta-annotated with a certain type of annotation.areNotAnnotatedWith
(DescribedPredicate<? super JavaAnnotation<?>> predicate) Matches classes not annotated with a certain annotation, where matching annotations are determined by the supplied predicate.areNotAnnotatedWith
(Class<? extends Annotation> annotationType) Matches classes not annotated with a certain type of annotation.areNotAnnotatedWith
(String annotationTypeName) Matches classes not annotated with a certain type of annotation.Matches everything except annotations.areNotAssignableFrom
(DescribedPredicate<? super JavaClass> predicate) Matches classes not assignable from a certain type matching the given predicate.areNotAssignableFrom
(Class<?> type) Matches classes not assignable from a certain type.areNotAssignableFrom
(String typeName) Matches classes not assignable from a certain type with the given type name.areNotAssignableTo
(DescribedPredicate<? super JavaClass> predicate) Matches classes not assignable to a certain type matching the given predicate.areNotAssignableTo
(Class<?> type) Matches classes not assignable to a certain type.areNotAssignableTo
(String typeName) Matches classes not assignable to a certain type with the given type name.Matches everything except enums.Matches everything except interfaces.areNotMetaAnnotatedWith
(DescribedPredicate<? super JavaAnnotation<?>> predicate) Matches classes not meta-annotated with a certain annotation, where matching meta-annotations are determined by the supplied predicate.areNotMetaAnnotatedWith
(Class<? extends Annotation> annotationType) Matches classes not meta-annotated with a certain type of annotation.areNotMetaAnnotatedWith
(String annotationTypeName) Matches classes not meta-annotated with a certain type of annotation.Matches non-package private classes.Matches non-private classes.Matches non-protected classes.Matches non-public classes.Matches everything except records.Matches package private classes.Matches private classes.Matches protected classes.Matches public classes.Matches records.belongToAnyOf
(Class<?>... classes) Matches every class in the supplied list and any of their named/anonymous inner classes, no matter how deeply nested.containAnyCodeUnitsThat
(DescribedPredicate<? super JavaCodeUnit> predicate) Matches classes that contain anycode unit
matching the supplied predicate.containAnyConstructorsThat
(DescribedPredicate<? super JavaConstructor> predicate) Matches classes that contain anyconstructor
matching the supplied predicate.containAnyFieldsThat
(DescribedPredicate<? super JavaField> predicate) Matches classes that contain anyfield
matching the supplied predicate.containAnyMembersThat
(DescribedPredicate<? super JavaMember> predicate) Matches classes that contain anymember
matching the supplied predicate.containAnyMethodsThat
(DescribedPredicate<? super JavaMethod> predicate) Matches classes that contain anymethod
matching the supplied predicate.containAnyStaticInitializersThat
(DescribedPredicate<? super JavaStaticInitializer> predicate) Matches classes that contain astatic initializer
matching the supplied predicate.doNotBelongToAnyOf
(Class<?>... classes) Inverted form ofbelongToAnyOf(Outer.class)
Matches classes that do not have a certain fully qualified class name.doNotHaveModifier
(JavaModifier modifier) Matches classes not having a certainJavaModifier
(e.g.doNotHaveSimpleName
(String name) Matches classes that do not have a certain simple class name.doNotImplement
(DescribedPredicate<? super JavaClass> predicate) Matches classes that do not implement a certain interface matching the given predicate.doNotImplement
(Class<?> type) Matches classes that do not implement a certain interface.doNotImplement
(String typeName) Matches classes that do not implement a certain interface with the given type name.haveFullyQualifiedName
(String name) Matches classes by their fully qualified class name.haveModifier
(JavaModifier modifier) Matches classes having a certainJavaModifier
(e.g.haveNameMatching
(String regex) Matches classes with a fully qualified class name matching a given regular expression.haveNameNotMatching
(String regex) Matches classes with a fully qualified class name not matching a given regular expression.haveSimpleName
(String name) Matches classes by their simple class name.haveSimpleNameContaining
(String infix) Matches classes with a simple class name containing the specified infix.haveSimpleNameEndingWith
(String suffix) Matches classes with a simple class name ending with a given suffix.Matches classes with a simple class name not containing the specified infix.haveSimpleNameNotEndingWith
(String suffix) Matches classes with a simple class name not ending with a given suffix.haveSimpleNameNotStartingWith
(String prefix) Matches classes with a simple class name not starting with a given prefix.haveSimpleNameStartingWith
(String prefix) Matches classes with a simple class name starting with a given prefix.implement
(DescribedPredicate<? super JavaClass> predicate) Matches classes that implement a certain interface matching the given predicate.Matches classes that implement a certain interface.Matches classes that implement a certain interface with the given type name.resideInAnyPackage
(String... packageIdentifiers) Matches classes residing in a package matching any of the supplied package identifiers.resideInAPackage
(String packageIdentifier) Matches classes residing in a package matching the supplied package identifier.resideOutsideOfPackage
(String packageIdentifier) Matches classes not residing in a package matching the supplied package identifier.resideOutsideOfPackages
(String... packageIdentifiers) Matches classes not residing in a package matching any of the supplied package identifiers.
-
Method Details
-
haveFullyQualifiedName
Matches classes by their fully qualified class name.- Parameters:
name
- The fully qualified class name- Returns:
- A syntax conjunction element, which can be completed to form a full rule
-
doNotHaveFullyQualifiedName
Matches classes that do not have a certain fully qualified class name.- Parameters:
name
- The fully qualified class name- Returns:
- A syntax conjunction element, which can be completed to form a full rule
-
haveSimpleName
Matches classes by their simple class name.- Parameters:
name
- The simple class name- Returns:
- A syntax conjunction element, which can be completed to form a full rule
-
doNotHaveSimpleName
Matches classes that do not have a certain simple class name.- Parameters:
name
- The simple class name- Returns:
- A syntax conjunction element, which can be completed to form a full rule
-
haveNameMatching
Matches classes with a fully qualified class name matching a given regular expression.- Parameters:
regex
- A regular expression- Returns:
- A syntax conjunction element, which can be completed to form a full rule
-
haveNameNotMatching
Matches classes with a fully qualified class name not matching a given regular expression.- Parameters:
regex
- A regular expression- Returns:
- A syntax conjunction element, which can be completed to form a full rule
-
haveSimpleNameStartingWith
Matches classes with a simple class name starting with a given prefix.- Parameters:
prefix
- A prefix the simple class name should start with- Returns:
- A syntax conjunction element, which can be completed to form a full rule
-
haveSimpleNameNotStartingWith
Matches classes with a simple class name not starting with a given prefix.- Parameters:
prefix
- A prefix the simple class name should not start with- Returns:
- A syntax conjunction element, which can be completed to form a full rule
-
haveSimpleNameContaining
Matches classes with a simple class name containing the specified infix.- Parameters:
infix
- An infix the simple class name should contain- Returns:
- A syntax conjunction element, which can be completed to form a full rule
-
haveSimpleNameNotContaining
Matches classes with a simple class name not containing the specified infix.- Parameters:
infix
- An infix the simple class name should not contain- Returns:
- A syntax conjunction element, which can be completed to form a full rule
-
haveSimpleNameEndingWith
Matches classes with a simple class name ending with a given suffix.- Parameters:
suffix
- A suffix the simple class name should end with- Returns:
- A syntax conjunction element, which can be completed to form a full rule
-
haveSimpleNameNotEndingWith
Matches classes with a simple class name not ending with a given suffix.- Parameters:
suffix
- A suffix the simple class name should not end with- Returns:
- A syntax conjunction element, which can be completed to form a full rule
-
resideInAPackage
Matches classes residing in a package matching the supplied package identifier.- Parameters:
packageIdentifier
- A string identifying packages, for details seePackageMatcher
- Returns:
- A syntax conjunction element, which can be completed to form a full rule
-
resideInAnyPackage
Matches classes residing in a package matching any of the supplied package identifiers.- Parameters:
packageIdentifiers
- Strings identifying packages, for details seePackageMatcher
- Returns:
- A syntax conjunction element, which can be completed to form a full rule
-
resideOutsideOfPackage
Matches classes not residing in a package matching the supplied package identifier.- Parameters:
packageIdentifier
- A string identifying packages, for details seePackageMatcher
- Returns:
- A syntax conjunction element, which can be completed to form a full rule
-
resideOutsideOfPackages
Matches classes not residing in a package matching any of the supplied package identifiers.- Parameters:
packageIdentifiers
- Strings identifying packages, for details seePackageMatcher
- Returns:
- A syntax conjunction element, which can be completed to form a full rule
-
arePublic
Matches public classes.- Returns:
- A syntax conjunction element, which can be completed to form a full rule
-
areNotPublic
Matches non-public classes.- Returns:
- A syntax conjunction element, which can be completed to form a full rule
-
areProtected
Matches protected classes.- Returns:
- A syntax conjunction element, which can be completed to form a full rule
-
areNotProtected
Matches non-protected classes.- Returns:
- A syntax conjunction element, which can be completed to form a full rule
-
arePackagePrivate
Matches package private classes.- Returns:
- A syntax conjunction element, which can be completed to form a full rule
-
areNotPackagePrivate
Matches non-package private classes.- Returns:
- A syntax conjunction element, which can be completed to form a full rule
-
arePrivate
Matches private classes.- Returns:
- A syntax conjunction element, which can be completed to form a full rule
-
areNotPrivate
Matches non-private classes.- Returns:
- A syntax conjunction element, which can be completed to form a full rule
-
haveModifier
Matches classes having a certainJavaModifier
(e.g.JavaModifier.ABSTRACT
).- Returns:
- A syntax conjunction element, which can be completed to form a full rule
-
doNotHaveModifier
Matches classes not having a certainJavaModifier
(e.g.JavaModifier.ABSTRACT
).- Returns:
- A syntax conjunction element, which can be completed to form a full rule
-
areAnnotatedWith
Matches classes annotated with a certain type of annotation.- Parameters:
annotationType
- Specific type ofAnnotation
- Returns:
- A syntax conjunction element, which can be completed to form a full rule
-
areNotAnnotatedWith
@PublicAPI(usage=ACCESS) CONJUNCTION areNotAnnotatedWith(Class<? extends Annotation> annotationType) Matches classes not annotated with a certain type of annotation.- Parameters:
annotationType
- Specific type ofAnnotation
- Returns:
- A syntax conjunction element, which can be completed to form a full rule
-
areAnnotatedWith
Matches classes annotated with a certain type of annotation.- Parameters:
annotationTypeName
- Fully qualified class name of a specific type ofAnnotation
- Returns:
- A syntax conjunction element, which can be completed to form a full rule
-
areNotAnnotatedWith
Matches classes not annotated with a certain type of annotation.- Parameters:
annotationTypeName
- Fully qualified class name of a specific type ofAnnotation
- Returns:
- A syntax conjunction element, which can be completed to form a full rule
-
areAnnotatedWith
@PublicAPI(usage=ACCESS) CONJUNCTION areAnnotatedWith(DescribedPredicate<? super JavaAnnotation<?>> predicate) Matches classes annotated with a certain annotation, where matching annotations are determined by the supplied predicate.
Note that many predefinedpredicates
can be found within a subclassPredicates
of the respective domain object or a common ancestor. For example,predicates
targetingJavaAnnotation
can be found within one of the respective ancestors likeHasType.Predicates
.- Parameters:
predicate
- A predicate defining matchingJavaAnnotations
- Returns:
- A syntax conjunction element, which can be completed to form a full rule
-
areNotAnnotatedWith
@PublicAPI(usage=ACCESS) CONJUNCTION areNotAnnotatedWith(DescribedPredicate<? super JavaAnnotation<?>> predicate) Matches classes not annotated with a certain annotation, where matching annotations are determined by the supplied predicate.
Note that many predefinedpredicates
can be found within a subclassPredicates
of the respective domain object or a common ancestor. For example,predicates
targetingJavaAnnotation
can be found within one of the respective ancestors likeHasType.Predicates
.- Parameters:
predicate
- A predicate defining matchingJavaAnnotations
- Returns:
- A syntax conjunction element, which can be completed to form a full rule
-
areMetaAnnotatedWith
@PublicAPI(usage=ACCESS) CONJUNCTION areMetaAnnotatedWith(Class<? extends Annotation> annotationType) Matches classes meta-annotated with a certain type of annotation. A meta-annotation is an annotation that is declared on another annotation.This also matches classes that are directly annotated with the supplied annotation type.
- Parameters:
annotationType
- Specific type ofAnnotation
- Returns:
- A syntax conjunction element, which can be completed to form a full rule
-
areNotMetaAnnotatedWith
@PublicAPI(usage=ACCESS) CONJUNCTION areNotMetaAnnotatedWith(Class<? extends Annotation> annotationType) Matches classes not meta-annotated with a certain type of annotation. A meta-annotation is an annotation that is declared on another annotation.Matching classes may also not directly be annotated with the supplied annotation type.
- Parameters:
annotationType
- Specific type ofAnnotation
- Returns:
- A syntax conjunction element, which can be completed to form a full rule
-
areMetaAnnotatedWith
Matches classes meta-annotated with a certain type of annotation. A meta-annotation is an annotation that is declared on another annotation.This also matches classes that are directly annotated with the supplied annotation type.
- Parameters:
annotationTypeName
- Fully qualified class name of a specific type ofAnnotation
- Returns:
- A syntax conjunction element, which can be completed to form a full rule
-
areNotMetaAnnotatedWith
Matches classes not meta-annotated with a certain type of annotation. A meta-annotation is an annotation that is declared on another annotation.Matching classes may also not directly be annotated with the supplied annotation type.
- Parameters:
annotationTypeName
- Fully qualified class name of a specific type ofAnnotation
- Returns:
- A syntax conjunction element, which can be completed to form a full rule
-
areMetaAnnotatedWith
@PublicAPI(usage=ACCESS) CONJUNCTION areMetaAnnotatedWith(DescribedPredicate<? super JavaAnnotation<?>> predicate) Matches classes 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.This also matches classes where a direct annotation matches the supplied predicate.
Note that many predefinedpredicates
can be found within a subclassPredicates
of the respective domain object or a common ancestor. For example,predicates
targetingJavaAnnotation
can be found within one of the respective ancestors likeHasType.Predicates
.- Parameters:
predicate
- A predicate defining matchingJavaAnnotations
- Returns:
- A syntax conjunction element, which can be completed to form a full rule
-
areNotMetaAnnotatedWith
@PublicAPI(usage=ACCESS) CONJUNCTION areNotMetaAnnotatedWith(DescribedPredicate<? super JavaAnnotation<?>> predicate) Matches classes 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.Matching classes may also not be annotated with a direct annotation matching the supplied predicate.
Note that many predefinedpredicates
can be found within a subclassPredicates
of the respective domain object or a common ancestor. For example,predicates
targetingJavaAnnotation
can be found within one of the respective ancestors likeHasType.Predicates
.- Parameters:
predicate
- A predicate defining matchingJavaAnnotations
- Returns:
- A syntax conjunction element, which can be completed to form a full rule
-
implement
Matches classes that implement a certain interface. Note that this only matches non-interfaceclasses
that implement the supplied interfacetype
(compareJavaClass.Predicates.implement(Class)
. For general assignability seeareAssignableTo(Class)
- Parameters:
type
- An interface type matching classes must implement- Returns:
- A syntax conjunction element, which can be completed to form a full rule
-
doNotImplement
Matches classes that do not implement a certain interface. This is the negation ofimplement(Class)
.- Parameters:
type
- An interface type matching classes must not implement- Returns:
- A syntax conjunction element, which can be completed to form a full rule
-
implement
Matches classes that implement a certain interface with the given type name. This is equivalent toimplement(Class)
, but does not depend on having a certain type on the classpath. Note that this only matches non-interfaceclasses
that implement the supplied interfacetypeName
(compareJavaClass.Predicates.implement(Class)
. For general assignability seeareAssignableTo(String)
- Parameters:
typeName
- Name of an interface type matching classes must implement- Returns:
- A syntax conjunction element, which can be completed to form a full rule
-
doNotImplement
Matches classes that do not implement a certain interface with the given type name. This is equivalent todoNotImplement(Class)
, but does not depend on having a certain type on the classpath.- Parameters:
typeName
- Name of an interface type matching classes must not implement- Returns:
- A syntax conjunction element, which can be completed to form a full rule
-
implement
Matches classes that implement a certain interface matching the given predicate. For example, a call withHasName.Predicates.name(String)
would be equivalent toimplement(String)
, but the approach is a lot more generic. Note that this only matches non-interfaceclasses
that implement an interface matching thepredicate
(compareJavaClass.Predicates.implement(Class)
. For general assignability seeareAssignableTo(DescribedPredicate)
Note that many predefinedpredicates
can be found within a subclassPredicates
of the respective domain object or a common ancestor. For example,predicates
targetingJavaClass
can be found withinJavaClass.Predicates
or one of the respective ancestors likeHasName.Predicates
.- Parameters:
predicate
- A predicate identifying interfaces matching classes must implement- Returns:
- A syntax conjunction element, which can be completed to form a full rule
-
doNotImplement
@PublicAPI(usage=ACCESS) CONJUNCTION doNotImplement(DescribedPredicate<? super JavaClass> predicate) Matches classes that do not implement a certain interface matching the given predicate. This is the negation ofimplement(DescribedPredicate)
.
Note that many predefinedpredicates
can be found within a subclassPredicates
of the respective domain object or a common ancestor. For example,predicates
targetingJavaClass
can be found withinJavaClass.Predicates
or one of the respective ancestors likeHasName.Predicates
.- Parameters:
predicate
- A predicate identifying interfaces matching classes must not implement- Returns:
- A syntax conjunction element, which can be completed to form a full rule
-
areAssignableTo
Matches classes assignable to a certain type (compareClass.isAssignableFrom(Class)
to terminology). A simple example for this predicate would beassignableTo(Object.class).test(importedStringClass); // --> returns true assignableTo(String.class).test(importedStringClass); // --> returns true assignableTo(List.class).test(importedStringClass); // --> returns false
- Parameters:
type
- An upper type bound to match imported classes against (imported subtypes will match)- Returns:
- A syntax conjunction element, which can be completed to form a full rule
-
areNotAssignableTo
Matches classes not assignable to a certain type. This is the negation ofareAssignableTo(Class)
.- Parameters:
type
- An upper type bound imported classes should NOT have- Returns:
- A syntax conjunction element, which can be completed to form a full rule
-
areAssignableTo
Matches classes assignable to a certain type with the given type name. This is equivalent toareAssignableTo(Class)
, but does not depend on having a certain type on the classpath.- Parameters:
typeName
- Name of an upper type bound to match imported classes against (imported subtypes will match)- Returns:
- A syntax conjunction element, which can be completed to form a full rule
-
areNotAssignableTo
Matches classes not assignable to a certain type with the given type name. This is equivalent toareNotAssignableTo(Class)
, but does not depend on having a certain type on the classpath.- Parameters:
typeName
- Name of an upper type bound imported classes should NOT have- Returns:
- A syntax conjunction element, which can be completed to form a full rule
-
areAssignableTo
@PublicAPI(usage=ACCESS) CONJUNCTION areAssignableTo(DescribedPredicate<? super JavaClass> predicate) Matches classes assignable to a certain type matching the given predicate. For example, a call withHasName.Predicates.name(String)
would be equivalent toareAssignableTo(String)
, but the approach is a lot more generic.
Note that many predefinedpredicates
can be found within a subclassPredicates
of the respective domain object or a common ancestor. For example,predicates
targetingJavaClass
can be found withinJavaClass.Predicates
or one of the respective ancestors likeHasName.Predicates
.- Parameters:
predicate
- A predicate identifying an upper type bound to match imported classes against (imported subtypes will match)- Returns:
- A syntax conjunction element, which can be completed to form a full rule
-
areNotAssignableTo
@PublicAPI(usage=ACCESS) CONJUNCTION areNotAssignableTo(DescribedPredicate<? super JavaClass> predicate) Matches classes not assignable to a certain type matching the given predicate. This is the negation ofareAssignableTo(DescribedPredicate)
.
Note that many predefinedpredicates
can be found within a subclassPredicates
of the respective domain object or a common ancestor. For example,predicates
targetingJavaClass
can be found withinJavaClass.Predicates
or one of the respective ancestors likeHasName.Predicates
.- Parameters:
predicate
- A predicate identifying an upper type bound imported classes should NOT have- Returns:
- A syntax conjunction element, which can be completed to form a full rule
-
areAssignableFrom
Matches classes assignable from a certain type (compareClass.isAssignableFrom(Class)
to terminology). This is roughly equivalent to the use of reflection:
A simple example for this predicate would besomeClass.class.isAssignableFrom(type);
assignableFrom(ArrayList.class).test(importedArrayListClass); // --> returns true assignableFrom(ArrayList.class).test(importedListClass); // --> returns true assignableFrom(ArrayList.class).test(importedStringClass); // --> returns false
- Parameters:
type
- A lower type bound to match imported classes against (imported supertypes will match)- Returns:
- A syntax conjunction element, which can be completed to form a full rule
-
areNotAssignableFrom
Matches classes not assignable from a certain type. This is the negation ofareAssignableFrom(Class)
.- Parameters:
type
- A lower type bound imported classes should NOT have- Returns:
- A syntax conjunction element, which can be completed to form a full rule
-
areAssignableFrom
Matches classes assignable from a certain type with the given type name. This is equivalent toareAssignableFrom(Class)
, but does not depend on having a certain type on the classpath.- Parameters:
typeName
- Name of a lower type bound to match imported classes against (imported supertypes will match)- Returns:
- A syntax conjunction element, which can be completed to form a full rule
-
areNotAssignableFrom
Matches classes not assignable from a certain type with the given type name. This is equivalent toareNotAssignableFrom(Class)
, but does not depend on having a certain type on the classpath.- Parameters:
typeName
- Name of a lower type bound imported classes should NOT have- Returns:
- A syntax conjunction element, which can be completed to form a full rule
-
areAssignableFrom
@PublicAPI(usage=ACCESS) CONJUNCTION areAssignableFrom(DescribedPredicate<? super JavaClass> predicate) Matches classes assignable from a certain type matching the given predicate. For example, a call withHasName.Predicates.name(String)
would be equivalent toareAssignableFrom(String)
, but the approach is a lot more generic.
Note that many predefinedpredicates
can be found within a subclassPredicates
of the respective domain object or a common ancestor. For example,predicates
targetingJavaClass
can be found withinJavaClass.Predicates
or one of the respective ancestors likeHasName.Predicates
.- Parameters:
predicate
- A predicate identifying a lower type bound to match imported classes against (imported supertypes will match)- Returns:
- A syntax conjunction element, which can be completed to form a full rule
-
areNotAssignableFrom
@PublicAPI(usage=ACCESS) CONJUNCTION areNotAssignableFrom(DescribedPredicate<? super JavaClass> predicate) Matches classes not assignable from a certain type matching the given predicate. This is the negation ofareAssignableFrom(DescribedPredicate)
.
Note that many predefinedpredicates
can be found within a subclassPredicates
of the respective domain object or a common ancestor. For example,predicates
targetingJavaClass
can be found withinJavaClass.Predicates
or one of the respective ancestors likeHasName.Predicates
.- Parameters:
predicate
- A predicate identifying a lower type bound imported classes should NOT have- Returns:
- A syntax conjunction element, which can be completed to form a full rule
-
areInterfaces
Matches interfaces.- Returns:
- A syntax conjunction element, which can be completed to form a full rule
-
areNotInterfaces
Matches everything except interfaces.- Returns:
- A syntax conjunction element, which can be completed to form a full rule
-
areEnums
Matches enums.- Returns:
- A syntax conjunction element, which can be completed to form a full rule
-
areNotEnums
Matches everything except enums.- Returns:
- A syntax conjunction element, which can be completed to form a full rule
-
areAnnotations
Matches annotations.- Returns:
- A syntax conjunction element, which can be completed to form a full rule
-
areNotAnnotations
Matches everything except annotations.- Returns:
- A syntax conjunction element, which can be completed to form a full rule
-
areRecords
Matches records.- Returns:
- A syntax conjunction element, which can be completed to form a full rule
- See Also:
-
areNotRecords
Matches everything except records.- Returns:
- A syntax conjunction element, which can be completed to form a full rule
- See Also:
-
areTopLevelClasses
-
areNotTopLevelClasses
-
areNestedClasses
-
areNotNestedClasses
-
areMemberClasses
-
areNotMemberClasses
-
areInnerClasses
-
areNotInnerClasses
-
areAnonymousClasses
-
areNotAnonymousClasses
-
areLocalClasses
-
areNotLocalClasses
-
belongToAnyOf
Matches every class in the supplied list and any of their named/anonymous inner classes, no matter how deeply nested. E.g. consider
Thenclass Outer { class Inner { class EvenMoreInner { } } }
belongToAnyOf(Outer.class)
would match theJavaClass
Outer
but alsoInner
andEvenMoreInner
. Likewise would hold for any anonymous inner classes.- Parameters:
classes
- List ofClass
objects.- Returns:
- A syntax conjunction element, which can be completed to form a full rule
-
doNotBelongToAnyOf
Inverted form ofbelongToAnyOf(Outer.class)
- Parameters:
classes
- List ofClass
objects.- Returns:
- A syntax conjunction element, which can be completed to form a full rule
-
containAnyMembersThat
@PublicAPI(usage=ACCESS) CONJUNCTION containAnyMembersThat(DescribedPredicate<? super JavaMember> predicate) Matches classes that contain anymember
matching the supplied predicate.
Note that many predefinedpredicates
can be found within a subclassPredicates
of the respective domain object or a common ancestor. For example,predicates
targetingJavaMember
can be found withinJavaMember.Predicates
or one of the respective ancestors likeHasName.Predicates
.- Parameters:
predicate
- A predicate defining matchingJavaMembers
- Returns:
- A syntax conjunction element, which can be completed to form a full rule
-
containAnyFieldsThat
@PublicAPI(usage=ACCESS) CONJUNCTION containAnyFieldsThat(DescribedPredicate<? super JavaField> predicate) Matches classes that contain anyfield
matching the supplied predicate.
Note that many predefinedpredicates
can be found within a subclassPredicates
of the respective domain object or a common ancestor. For example,predicates
targetingJavaField
can be found withinJavaMember.Predicates
or one of the respective ancestors likeHasName.Predicates
.- Parameters:
predicate
- A predicate defining matchingJavaFields
- Returns:
- A syntax conjunction element, which can be completed to form a full rule
-
containAnyCodeUnitsThat
@PublicAPI(usage=ACCESS) CONJUNCTION containAnyCodeUnitsThat(DescribedPredicate<? super JavaCodeUnit> predicate) Matches classes that contain anycode unit
matching the supplied predicate.
Note that many predefinedpredicates
can be found within a subclassPredicates
of the respective domain object or a common ancestor. For example,predicates
targetingJavaCodeUnit
can be found withinJavaCodeUnit.Predicates
or one of the respective ancestors likeJavaMember.Predicates
.- Parameters:
predicate
- A predicate defining matchingJavaCodeUnits
- Returns:
- A syntax conjunction element, which can be completed to form a full rule
-
containAnyMethodsThat
@PublicAPI(usage=ACCESS) CONJUNCTION containAnyMethodsThat(DescribedPredicate<? super JavaMethod> predicate) Matches classes that contain anymethod
matching the supplied predicate.
Note that many predefinedpredicates
can be found within a subclassPredicates
of the respective domain object or a common ancestor. For example,predicates
targetingJavaMethod
can be found withinJavaCodeUnit.Predicates
or one of the respective ancestors likeJavaMember.Predicates
.- Parameters:
predicate
- A predicate defining matchingJavaMethods
- Returns:
- A syntax conjunction element, which can be completed to form a full rule
-
containAnyConstructorsThat
@PublicAPI(usage=ACCESS) CONJUNCTION containAnyConstructorsThat(DescribedPredicate<? super JavaConstructor> predicate) Matches classes that contain anyconstructor
matching the supplied predicate.
Note that many predefinedpredicates
can be found within a subclassPredicates
of the respective domain object or a common ancestor. For example,predicates
targetingJavaConstructor
can be found withinJavaCodeUnit.Predicates
or one of the respective ancestors likeJavaMember.Predicates
.- Parameters:
predicate
- A predicate defining matchingJavaConstructors
- Returns:
- A syntax conjunction element, which can be completed to form a full rule
-
containAnyStaticInitializersThat
@PublicAPI(usage=ACCESS) CONJUNCTION containAnyStaticInitializersThat(DescribedPredicate<? super JavaStaticInitializer> predicate) Matches classes that contain astatic initializer
matching the supplied predicate.
Note that many predefinedpredicates
can be found within a subclassPredicates
of the respective domain object or a common ancestor. For example,predicates
targetingJavaStaticInitializer
can be found withinJavaCodeUnit.Predicates
or one of the respective ancestors likeJavaMember.Predicates
.- Parameters:
predicate
- A predicate defining matchingJavaStaticInitializers
- Returns:
- A syntax conjunction element, which can be completed to form a full rule
-