Interface ClassesShould
-
public interface ClassesShould
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description ClassesThat<ClassesShouldConjunction>accessClassesThat()Asserts that all classes selected by this rule access certain classes (compareonlyAccessClassesThat()).
NOTE: This usually makes more sense the negated way, e.g.ClassesShouldConjunctionaccessClassesThat(DescribedPredicate<? super JavaClass> predicate)Asserts that all classes selected by this rule access certain classes (compareonlyAccessClassesThat(DescribedPredicate).
NOTE: This usually makes more sense the negated way, e.g.ClassesShouldConjunctionaccessField(java.lang.Class<?> owner, java.lang.String fieldName)Matches against all accesses (setting or getting) of a specific field.ClassesShouldConjunctionaccessField(java.lang.String ownerName, java.lang.String fieldName)Matches against all accesses (setting or getting) of a specific field.ClassesShouldConjunctionaccessFieldWhere(DescribedPredicate<? super JavaFieldAccess> predicate)Matches against accessing fields, where origin (a method or constructor) and target (a field) can be freely restricted by the supplied predicate.ClassesShouldConjunctionaccessTargetWhere(DescribedPredicate<? super JavaAccess<?>> predicate)Matches against access of arbitrary targets (compareAccessTarget) where origin (a method or constructor) and target (a field, method or constructor) can be freely restricted by the supplied predicate.ClassesShouldConjunctionbe(java.lang.Class<?> clazz)Asserts that the rule matches exactly the given class.ClassesShouldConjunctionbe(java.lang.String className)Asserts that the rule matches exactly the class with the given fully qualified class name.ClassesShouldConjunctionbeAnnotatedWith(DescribedPredicate<? super JavaAnnotation> predicate)Asserts that classes are annotated with a certain annotation, where matching annotations are determined by the supplied predicate.ClassesShouldConjunctionbeAnnotatedWith(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)Asserts that classes are annotated with a certain type of annotation.ClassesShouldConjunctionbeAnnotatedWith(java.lang.String annotationTypeName)Asserts that classes are annotated with a certain type of annotation.ClassesShouldConjunctionbeAssignableFrom(DescribedPredicate<? super JavaClass> predicate)Asserts that classes are assignable from a certain type matching the given predicate.ClassesShouldConjunctionbeAssignableFrom(java.lang.Class<?> type)Asserts that classes are assignable from a certain type (compareClass.isAssignableFrom(Class)to terminology).ClassesShouldConjunctionbeAssignableFrom(java.lang.String typeName)Asserts that classes are assignable from a certain type with the given type name.ClassesShouldConjunctionbeAssignableTo(DescribedPredicate<? super JavaClass> predicate)Asserts that classes are assignable to a certain type matching the given predicate.ClassesShouldConjunctionbeAssignableTo(java.lang.Class<?> type)Asserts that classes are assignable to a certain type (compareClass.isAssignableFrom(Class)to terminology).ClassesShouldConjunctionbeAssignableTo(java.lang.String typeName)Asserts that classes are assignable to a certain type with the given type name.ClassesShouldConjunctionbeEnums()Asserts that classes are enums.ClassesShouldConjunctionbeInterfaces()Asserts that classes are interfaces.ClassesShouldConjunctionbeMetaAnnotatedWith(DescribedPredicate<? super JavaAnnotation> predicate)Asserts that classes are meta-annotated with a certain annotation, where matching meta-annotations are determined by the supplied predicate.ClassesShouldConjunctionbeMetaAnnotatedWith(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)Asserts that classes are meta-annotated with a certain type of annotation.ClassesShouldConjunctionbeMetaAnnotatedWith(java.lang.String annotationTypeName)Asserts that classes are meta-annotated with a certain type of annotation.ClassesShouldConjunctionbePackagePrivate()Asserts that classes are package private.ClassesShouldConjunctionbePrivate()Asserts that classes are private.ClassesShouldConjunctionbeProtected()Asserts that classes are protected.ClassesShouldConjunctionbePublic()Asserts that classes are public.ClassesShouldConjunctioncallCodeUnitWhere(DescribedPredicate<? super JavaCall<?>> predicate)Matches against code unit calls (compareJavaCodeUnit) where origin (a code unit) and target (a code unit) can be freely restricted by the supplied predicate.ClassesShouldConjunctioncallConstructor(java.lang.Class<?> owner, java.lang.Class<?>... parameterTypes)Matches against a constructor call to a specific constructor (e.g.ClassesShouldConjunctioncallConstructor(java.lang.String ownerName, java.lang.String... parameterTypeNames)Matches against constructor call to a specific constructor (e.g.ClassesShouldConjunctioncallConstructorWhere(DescribedPredicate<? super JavaConstructorCall> predicate)Matches against constructor calls where origin (a method or constructor) and target (a constructor) can be freely restricted by the supplied predicate.ClassesShouldConjunctioncallMethod(java.lang.Class<?> owner, java.lang.String methodName, java.lang.Class<?>... parameterTypes)Matches against a method call to a specific method (e.g.ClassesShouldConjunctioncallMethod(java.lang.String ownerName, java.lang.String methodName, java.lang.String... parameterTypeNames)Matches against method call to a specific method (e.g.ClassesShouldConjunctioncallMethodWhere(DescribedPredicate<? super JavaMethodCall> predicate)Matches against method calls where origin (a method or constructor) and target (a method) can be freely restricted by the supplied predicate.ClassesShouldConjunctioncontainNumberOfElements(DescribedPredicate<java.lang.Integer> predicate)Asserts that the number of classes checked by this rule conforms to the supplied predicate.ClassesThat<ClassesShouldConjunction>dependOnClassesThat()Asserts that all classes selected by this rule depend on certain classes.
NOTE: This usually makes more sense the negated way, e.g.ClassesShouldConjunctiondependOnClassesThat(DescribedPredicate<? super JavaClass> predicate)Asserts that all classes selected by this rule depend on certain classes.
NOTE: This usually makes more sense the negated way, e.g.ClassesShouldConjunctiongetField(java.lang.Class<?> owner, java.lang.String fieldName)Matches against getting of a specific field (e.g.ClassesShouldConjunctiongetField(java.lang.String ownerName, java.lang.String fieldName)Matches against getting a specific field (e.g.ClassesShouldConjunctiongetFieldWhere(DescribedPredicate<? super JavaFieldAccess> predicate)Matches against getting of fields, where origin (a method or constructor) and target (a field) can be freely restricted by the supplied predicate.ClassesShouldConjunctionhaveFullyQualifiedName(java.lang.String name)Asserts that classes have a certain fully qualified class name.ClassesShouldConjunctionhaveModifier(JavaModifier modifier)Asserts that classes have a certainJavaModifier(e.g.ClassesShouldConjunctionhaveNameMatching(java.lang.String regex)Asserts that classes have a fully qualified class name matching a given regular expression.ClassesShouldConjunctionhaveNameNotMatching(java.lang.String regex)Asserts that classes have a fully qualified class name not matching a given regular expression.ClassesShouldConjunctionhaveOnlyFinalFields()Asserts that classes have only final fields.ClassesShouldConjunctionhaveOnlyPrivateConstructors()Asserts that classes have only private constructors.ClassesShouldConjunctionhaveSimpleName(java.lang.String name)Asserts that classes have a certain simple class name.ClassesShouldConjunctionhaveSimpleNameContaining(java.lang.String infix)Asserts that classes' simple class names contain the specified infix.ClassesShouldConjunctionhaveSimpleNameEndingWith(java.lang.String suffix)Asserts that classes' simple class names end with a given suffix.ClassesShouldConjunctionhaveSimpleNameNotContaining(java.lang.String infix)Asserts that classes' simple class names do not contain the specified infix.ClassesShouldConjunctionhaveSimpleNameNotEndingWith(java.lang.String suffix)Asserts that classes' simple class names do not end with a given suffix.ClassesShouldConjunctionhaveSimpleNameNotStartingWith(java.lang.String prefix)Asserts that classes' simple class names do not start with a given prefix.ClassesShouldConjunctionhaveSimpleNameStartingWith(java.lang.String prefix)Asserts that classes' simple class names start with a given prefix.ClassesShouldConjunctionimplement(DescribedPredicate<? super JavaClass> predicate)Asserts that classes implement a certain interface matching the given predicate.ClassesShouldConjunctionimplement(java.lang.Class<?> type)Asserts that classes implement a certain interface.ClassesShouldConjunctionimplement(java.lang.String typeName)Asserts that classes implement a certain interface with the given type name.ClassesShouldConjunctionnotBe(java.lang.Class<?> clazz)Asserts that the rule does not match the given class.ClassesShouldConjunctionnotBe(java.lang.String className)Asserts that the rule does not match the class with the given fully qualified class name.ClassesShouldConjunctionnotBeAnnotatedWith(DescribedPredicate<? super JavaAnnotation> predicate)Asserts that classes are not annotated with a certain annotation, where matching annotations are determined by the supplied predicate.ClassesShouldConjunctionnotBeAnnotatedWith(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)Asserts that classes are not annotated with a certain type of annotation.ClassesShouldConjunctionnotBeAnnotatedWith(java.lang.String annotationTypeName)Asserts that classes are not annotated with a certain type of annotation.ClassesShouldConjunctionnotBeAssignableFrom(DescribedPredicate<? super JavaClass> predicate)Asserts that classes are not assignable from a certain type matching the given predicate.ClassesShouldConjunctionnotBeAssignableFrom(java.lang.Class<?> type)Asserts that classes are not assignable from a certain type.ClassesShouldConjunctionnotBeAssignableFrom(java.lang.String typeName)Asserts that classes are not assignable from a certain type with the given type name.ClassesShouldConjunctionnotBeAssignableTo(DescribedPredicate<? super JavaClass> predicate)Asserts that classes are not assignable to a certain type matching the given predicate.ClassesShouldConjunctionnotBeAssignableTo(java.lang.Class<?> type)Asserts that classes are not assignable to a certain type.ClassesShouldConjunctionnotBeAssignableTo(java.lang.String typeName)Asserts that classes are not assignable to a certain type with the given type name.ClassesShouldConjunctionnotBeEnums()Asserts that classes are not enums.ClassesShouldConjunctionnotBeInterfaces()Asserts that classes are not interfaces.ClassesShouldConjunctionnotBeMetaAnnotatedWith(DescribedPredicate<? super JavaAnnotation> predicate)Asserts that classes are not meta-annotated with a certain annotation, where matching meta-annotations are determined by the supplied predicate.ClassesShouldConjunctionnotBeMetaAnnotatedWith(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)Asserts that classes are not meta-annotated with a certain type of annotation.ClassesShouldConjunctionnotBeMetaAnnotatedWith(java.lang.String annotationTypeName)Asserts that classes are not meta-annotated with a certain type of annotation.ClassesShouldConjunctionnotBePackagePrivate()Asserts that classes are non-package private.ClassesShouldConjunctionnotBePrivate()Asserts that classes are non-private.ClassesShouldConjunctionnotBeProtected()Asserts that classes are non-protected.ClassesShouldConjunctionnotBePublic()Asserts that classes are non-public.ClassesShouldConjunctionnotHaveFullyQualifiedName(java.lang.String name)Asserts that classes do not have a certain fully qualified class name.ClassesShouldConjunctionnotHaveModifier(JavaModifier modifier)Asserts that classes do not have a certainJavaModifier(e.g.ClassesShouldConjunctionnotHaveSimpleName(java.lang.String name)Asserts that classes do not have a certain simple class name.ClassesShouldConjunctionnotImplement(DescribedPredicate<? super JavaClass> predicate)Asserts that classes do not implement a certain interface matching the given predicate.ClassesShouldConjunctionnotImplement(java.lang.Class<?> type)Asserts that classes do not implement a certain interface.ClassesShouldConjunctionnotImplement(java.lang.String typeName)Asserts that classes do not implement a certain interface with the given type name.ClassesThat<ClassesShouldConjunction>onlyAccessClassesThat()Asserts that all classes selected by this rule ONLY access certain classes (compareaccessClassesThat()).
E.g.ClassesShouldConjunctiononlyAccessClassesThat(DescribedPredicate<? super JavaClass> predicate)Asserts that all classes selected by this rule ONLY access certain classes (compareaccessClassesThat(DescribedPredicate)).
E.g.ClassesShouldConjunctiononlyAccessFieldsThat(DescribedPredicate<? super JavaField> predicate)Matches all field accesses against the supplied predicate.ClassesShouldConjunctiononlyAccessMembersThat(DescribedPredicate<? super JavaMember> predicate)Matches all members calls against the supplied predicate.OnlyBeAccessedSpecification<ClassesShouldConjunction>onlyBeAccessed()ClassesShouldConjunctiononlyCallCodeUnitsThat(DescribedPredicate<? super JavaCodeUnit> predicate)Matches all code unit calls against the supplied predicate.ClassesShouldConjunctiononlyCallConstructorsThat(DescribedPredicate<? super JavaConstructor> predicate)Matches all constructor calls against the supplied predicate.ClassesShouldConjunctiononlyCallMethodsThat(DescribedPredicate<? super JavaMethod> predicate)Matches all method calls against the supplied predicate.ClassesThat<ClassesShouldConjunction>onlyDependOnClassesThat()Asserts that all classes selected by this rule ONLY depend on certain classes (comparedependOnClassesThat()).
E.g.ClassesShouldConjunctiononlyDependOnClassesThat(DescribedPredicate<? super JavaClass> predicate)Asserts that all classes selected by this rule ONLY depend on certain classes (comparedependOnClassesThat(DescribedPredicate)).
E.g.ClassesThat<ClassesShouldConjunction>onlyHaveDependentClassesThat()Asserts that only certain classes depend on the classes selected by this rule.
E.g.ClassesShouldConjunctiononlyHaveDependentClassesThat(DescribedPredicate<? super JavaClass> predicate)Asserts that only certain classes depend on the classes selected by this rule.
E.g.ClassesShouldConjunctionresideInAnyPackage(java.lang.String... packageIdentifiers)Asserts that classes reside in a package matching any of the supplied package identifiers.ClassesShouldConjunctionresideInAPackage(java.lang.String packageIdentifier)Asserts that classes reside in a package matching the supplied package identifier.ClassesShouldConjunctionresideOutsideOfPackage(java.lang.String packageIdentifier)Asserts that classes do not reside in a package matching the supplied package identifier.ClassesShouldConjunctionresideOutsideOfPackages(java.lang.String... packageIdentifiers)Asserts that classes do not reside in a package matching any of the supplied package identifiers.ClassesShouldConjunctionsetField(java.lang.Class<?> owner, java.lang.String fieldName)Matches against setting a specific field (e.g.ClassesShouldConjunctionsetField(java.lang.String ownerName, java.lang.String fieldName)Matches against setting a specific field (e.g.ClassesShouldConjunctionsetFieldWhere(DescribedPredicate<? super JavaFieldAccess> predicate)Matches against setting of fields, where origin (a method or constructor) and target (a field) can be freely restricted by the supplied predicate.
-
-
-
Method Detail
-
haveFullyQualifiedName
@PublicAPI(usage=ACCESS) ClassesShouldConjunction haveFullyQualifiedName(java.lang.String name)
Asserts that classes have a certain fully qualified class name.- Parameters:
name- The fully qualified class name- Returns:
- A syntax element that can either be used as working rule, or to continue specifying a more complex rule
-
notHaveFullyQualifiedName
@PublicAPI(usage=ACCESS) ClassesShouldConjunction notHaveFullyQualifiedName(java.lang.String name)
Asserts that classes do not have a certain fully qualified class name.- Parameters:
name- The fully qualified class name- Returns:
- A syntax element that can either be used as working rule, or to continue specifying a more complex rule
-
haveSimpleName
@PublicAPI(usage=ACCESS) ClassesShouldConjunction haveSimpleName(java.lang.String name)
Asserts that classes have a certain simple class name.- Parameters:
name- The simple class name- Returns:
- A syntax element that can either be used as working rule, or to continue specifying a more complex rule
-
notHaveSimpleName
@PublicAPI(usage=ACCESS) ClassesShouldConjunction notHaveSimpleName(java.lang.String name)
Asserts that classes do not have a certain simple class name.- Parameters:
name- The simple class name- Returns:
- A syntax element that can either be used as working rule, or to continue specifying a more complex rule
-
haveSimpleNameStartingWith
@PublicAPI(usage=ACCESS) ClassesShouldConjunction haveSimpleNameStartingWith(java.lang.String prefix)
Asserts that classes' simple class names start with a given prefix.- Parameters:
prefix- A prefix the simple class name should start with- Returns:
- A syntax element that can either be used as working rule, or to continue specifying a more complex rule
-
haveSimpleNameNotStartingWith
@PublicAPI(usage=ACCESS) ClassesShouldConjunction haveSimpleNameNotStartingWith(java.lang.String prefix)
Asserts that classes' simple class names do not start with a given prefix.- Parameters:
prefix- A prefix the simple class name should not start with- Returns:
- A syntax element that can either be used as working rule, or to continue specifying a more complex rule
-
haveSimpleNameContaining
@PublicAPI(usage=ACCESS) ClassesShouldConjunction haveSimpleNameContaining(java.lang.String infix)
Asserts that classes' simple class names contain the specified infix.- Parameters:
infix- An infix the simple class name should contain- Returns:
- A syntax element that can either be used as working rule, or to continue specifying a more complex rule
-
haveSimpleNameNotContaining
@PublicAPI(usage=ACCESS) ClassesShouldConjunction haveSimpleNameNotContaining(java.lang.String infix)
Asserts that classes' simple class names do not contain the specified infix.- Parameters:
infix- An infix the simple class name should not contain- Returns:
- A syntax element that can either be used as working rule, or to continue specifying a more complex rule
-
haveSimpleNameEndingWith
@PublicAPI(usage=ACCESS) ClassesShouldConjunction haveSimpleNameEndingWith(java.lang.String suffix)
Asserts that classes' simple class names end with a given suffix.- Parameters:
suffix- A suffix the simple class name should end with- Returns:
- A syntax element that can either be used as working rule, or to continue specifying a more complex rule
-
haveSimpleNameNotEndingWith
@PublicAPI(usage=ACCESS) ClassesShouldConjunction haveSimpleNameNotEndingWith(java.lang.String suffix)
Asserts that classes' simple class names do not end with a given suffix.- Parameters:
suffix- A suffix the simple class name should not end with- Returns:
- A syntax element that can either be used as working rule, or to continue specifying a more complex rule
-
haveNameMatching
@PublicAPI(usage=ACCESS) ClassesShouldConjunction haveNameMatching(java.lang.String regex)
Asserts that classes have a fully qualified class name matching a given regular expression.- Parameters:
regex- A regular expression- Returns:
- A syntax element that can either be used as working rule, or to continue specifying a more complex rule
-
haveNameNotMatching
@PublicAPI(usage=ACCESS) ClassesShouldConjunction haveNameNotMatching(java.lang.String regex)
Asserts that classes have a fully qualified class name not matching a given regular expression.- Parameters:
regex- A regular expression- Returns:
- A syntax element that can either be used as working rule, or to continue specifying a more complex rule
-
resideInAPackage
@PublicAPI(usage=ACCESS) ClassesShouldConjunction resideInAPackage(java.lang.String packageIdentifier)
Asserts that classes reside in a package matching the supplied package identifier.- Parameters:
packageIdentifier- A string identifying packages, for details seePackageMatcher- Returns:
- A syntax element that can either be used as working rule, or to continue specifying a more complex rule
-
resideInAnyPackage
@PublicAPI(usage=ACCESS) ClassesShouldConjunction resideInAnyPackage(java.lang.String... packageIdentifiers)
Asserts that classes reside in a package matching any of the supplied package identifiers.- Parameters:
packageIdentifiers- Strings identifying packages, for details seePackageMatcher- Returns:
- A syntax element that can either be used as working rule, or to continue specifying a more complex rule
-
resideOutsideOfPackage
@PublicAPI(usage=ACCESS) ClassesShouldConjunction resideOutsideOfPackage(java.lang.String packageIdentifier)
Asserts that classes do not reside in a package matching the supplied package identifier.- Parameters:
packageIdentifier- A string identifying packages, for details seePackageMatcher- Returns:
- A syntax element that can either be used as working rule, or to continue specifying a more complex rule
-
resideOutsideOfPackages
@PublicAPI(usage=ACCESS) ClassesShouldConjunction resideOutsideOfPackages(java.lang.String... packageIdentifiers)
Asserts that classes do not reside in a package matching any of the supplied package identifiers.- Parameters:
packageIdentifiers- Strings identifying packages, for details seePackageMatcher- Returns:
- A syntax element that can either be used as working rule, or to continue specifying a more complex rule
-
bePublic
@PublicAPI(usage=ACCESS) ClassesShouldConjunction bePublic()
Asserts that classes are public.- Returns:
- A syntax element that can either be used as working rule, or to continue specifying a more complex rule
-
notBePublic
@PublicAPI(usage=ACCESS) ClassesShouldConjunction notBePublic()
Asserts that classes are non-public.- Returns:
- A syntax element that can either be used as working rule, or to continue specifying a more complex rule
-
beProtected
@PublicAPI(usage=ACCESS) ClassesShouldConjunction beProtected()
Asserts that classes are protected.- Returns:
- A syntax element that can either be used as working rule, or to continue specifying a more complex rule
-
notBeProtected
@PublicAPI(usage=ACCESS) ClassesShouldConjunction notBeProtected()
Asserts that classes are non-protected.- Returns:
- A syntax element that can either be used as working rule, or to continue specifying a more complex rule
-
bePackagePrivate
@PublicAPI(usage=ACCESS) ClassesShouldConjunction bePackagePrivate()
Asserts that classes are package private.- Returns:
- A syntax element that can either be used as working rule, or to continue specifying a more complex rule
-
notBePackagePrivate
@PublicAPI(usage=ACCESS) ClassesShouldConjunction notBePackagePrivate()
Asserts that classes are non-package private.- Returns:
- A syntax element that can either be used as working rule, or to continue specifying a more complex rule
-
bePrivate
@PublicAPI(usage=ACCESS) ClassesShouldConjunction bePrivate()
Asserts that classes are private.- Returns:
- A syntax element that can either be used as working rule, or to continue specifying a more complex rule
-
notBePrivate
@PublicAPI(usage=ACCESS) ClassesShouldConjunction notBePrivate()
Asserts that classes are non-private.- Returns:
- A syntax element that can either be used as working rule, or to continue specifying a more complex rule
-
haveOnlyFinalFields
@PublicAPI(usage=ACCESS) ClassesShouldConjunction haveOnlyFinalFields()
Asserts that classes have only final fields.- Returns:
- A syntax element that can either be used as working rule, or to continue specifying a more complex rule
-
haveOnlyPrivateConstructors
@PublicAPI(usage=ACCESS) ClassesShouldConjunction haveOnlyPrivateConstructors()
Asserts that classes have only private constructors.- Returns:
- A syntax element that can either be used as working rule, or to continue specifying a more complex rule
-
haveModifier
@PublicAPI(usage=ACCESS) ClassesShouldConjunction haveModifier(JavaModifier modifier)
Asserts that classes have a certainJavaModifier(e.g.JavaModifier.ABSTRACT).- Returns:
- A syntax element that can either be used as working rule, or to continue specifying a more complex rule
-
notHaveModifier
@PublicAPI(usage=ACCESS) ClassesShouldConjunction notHaveModifier(JavaModifier modifier)
Asserts that classes do not have a certainJavaModifier(e.g.JavaModifier.ABSTRACT).- Returns:
- A syntax element that can either be used as working rule, or to continue specifying a more complex rule
-
beAnnotatedWith
@PublicAPI(usage=ACCESS) ClassesShouldConjunction beAnnotatedWith(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
Asserts that classes are annotated with a certain type of annotation.- Parameters:
annotationType- Specific type ofAnnotation- Returns:
- A syntax element that can either be used as working rule, or to continue specifying a more complex rule
-
notBeAnnotatedWith
@PublicAPI(usage=ACCESS) ClassesShouldConjunction notBeAnnotatedWith(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
Asserts that classes are not annotated with a certain type of annotation.- Parameters:
annotationType- Specific type ofAnnotation- Returns:
- A syntax element that can either be used as working rule, or to continue specifying a more complex rule
-
beAnnotatedWith
@PublicAPI(usage=ACCESS) ClassesShouldConjunction beAnnotatedWith(java.lang.String annotationTypeName)
Asserts that classes are annotated with a certain type of annotation.- Parameters:
annotationTypeName- Fully qualified class name of a specific type ofAnnotation- Returns:
- A syntax element that can either be used as working rule, or to continue specifying a more complex rule
-
notBeAnnotatedWith
@PublicAPI(usage=ACCESS) ClassesShouldConjunction notBeAnnotatedWith(java.lang.String annotationTypeName)
Asserts that classes are not annotated with a certain type of annotation.- Parameters:
annotationTypeName- Fully qualified class name of a specific type ofAnnotation- Returns:
- A syntax element that can either be used as working rule, or to continue specifying a more complex rule
-
beAnnotatedWith
@PublicAPI(usage=ACCESS) ClassesShouldConjunction beAnnotatedWith(DescribedPredicate<? super JavaAnnotation> predicate)
Asserts that classes are annotated with a certain annotation, where matching annotations are determined by the supplied predicate.- Parameters:
predicate- A predicate defining matchingJavaAnnotations- Returns:
- A syntax element that can either be used as working rule, or to continue specifying a more complex rule
-
notBeAnnotatedWith
@PublicAPI(usage=ACCESS) ClassesShouldConjunction notBeAnnotatedWith(DescribedPredicate<? super JavaAnnotation> predicate)
Asserts that classes are not annotated with a certain annotation, where matching annotations are determined by the supplied predicate.- Parameters:
predicate- A predicate defining matchingJavaAnnotations- Returns:
- A syntax element that can either be used as working rule, or to continue specifying a more complex rule
-
beMetaAnnotatedWith
@PublicAPI(usage=ACCESS) ClassesShouldConjunction beMetaAnnotatedWith(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
Asserts that classes are meta-annotated with a certain type of annotation. A meta-annotation is an annotation that is declared on another annotation.- Parameters:
annotationType- Specific type ofAnnotation- Returns:
- A syntax element that can either be used as working rule, or to continue specifying a more complex rule
-
notBeMetaAnnotatedWith
@PublicAPI(usage=ACCESS) ClassesShouldConjunction notBeMetaAnnotatedWith(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
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.- Parameters:
annotationType- Specific type ofAnnotation- Returns:
- A syntax element that can either be used as working rule, or to continue specifying a more complex rule
-
beMetaAnnotatedWith
@PublicAPI(usage=ACCESS) ClassesShouldConjunction beMetaAnnotatedWith(java.lang.String annotationTypeName)
Asserts that classes are meta-annotated with a certain type of annotation. A meta-annotation is an annotation that is declared on another annotation.- Parameters:
annotationTypeName- Fully qualified class name of a specific type ofAnnotation- Returns:
- A syntax element that can either be used as working rule, or to continue specifying a more complex rule
-
notBeMetaAnnotatedWith
@PublicAPI(usage=ACCESS) ClassesShouldConjunction notBeMetaAnnotatedWith(java.lang.String annotationTypeName)
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.- Parameters:
annotationTypeName- Fully qualified class name of a specific type ofAnnotation- Returns:
- A syntax element that can either be used as working rule, or to continue specifying a more complex rule
-
beMetaAnnotatedWith
@PublicAPI(usage=ACCESS) ClassesShouldConjunction beMetaAnnotatedWith(DescribedPredicate<? super JavaAnnotation> predicate)
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.- Parameters:
predicate- A predicate defining matchingJavaAnnotations- Returns:
- A syntax element that can either be used as working rule, or to continue specifying a more complex rule
-
notBeMetaAnnotatedWith
@PublicAPI(usage=ACCESS) ClassesShouldConjunction notBeMetaAnnotatedWith(DescribedPredicate<? super JavaAnnotation> predicate)
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.- Parameters:
predicate- A predicate defining matchingJavaAnnotations- Returns:
- A syntax element that can either be used as working rule, or to continue specifying a more complex rule
-
implement
@PublicAPI(usage=ACCESS) ClassesShouldConjunction implement(java.lang.Class<?> type)
Asserts that classes implement a certain interface.- Parameters:
type- An interface imported classes should implement- Returns:
- A syntax element that can either be used as working rule, or to continue specifying a more complex rule
-
notImplement
@PublicAPI(usage=ACCESS) ClassesShouldConjunction notImplement(java.lang.Class<?> type)
Asserts that classes do not implement a certain interface. This is the negation ofimplement(Class).- Parameters:
type- An interface imported classes should NOT implement- Returns:
- A syntax element that can either be used as working rule, or to continue specifying a more complex rule
-
implement
@PublicAPI(usage=ACCESS) ClassesShouldConjunction implement(java.lang.String typeName)
Asserts that classes 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.- Parameters:
typeName- Name of an interface imported classes should implement- Returns:
- A syntax element that can either be used as working rule, or to continue specifying a more complex rule
-
notImplement
@PublicAPI(usage=ACCESS) ClassesShouldConjunction notImplement(java.lang.String typeName)
Asserts that classes do not implement a certain interface with the given type name. This is equivalent tonotImplement(Class), but does not depend on having a certain type on the classpath.- Parameters:
typeName- Name of an interface imported classes should NOT implement- Returns:
- A syntax element that can either be used as working rule, or to continue specifying a more complex rule
-
implement
@PublicAPI(usage=ACCESS) ClassesShouldConjunction implement(DescribedPredicate<? super JavaClass> predicate)
Asserts that classes 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.- Parameters:
predicate- A predicate identifying an interface imported classes should implement- Returns:
- A syntax element that can either be used as working rule, or to continue specifying a more complex rule
-
notImplement
@PublicAPI(usage=ACCESS) ClassesShouldConjunction notImplement(DescribedPredicate<? super JavaClass> predicate)
Asserts that classes do not implement a certain interface matching the given predicate. This is the negation ofimplement(DescribedPredicate).- Parameters:
predicate- A predicate identifying an interface imported classes should NOT implement- Returns:
- A syntax element that can either be used as working rule, or to continue specifying a more complex rule
-
beAssignableTo
@PublicAPI(usage=ACCESS) ClassesShouldConjunction beAssignableTo(java.lang.Class<?> type)
Asserts that classes are assignable to a certain type (compareClass.isAssignableFrom(Class)to terminology). A simple example for this predicate would beassignableTo(Object.class).apply(importedStringClass); // --> returns true assignableTo(String.class).apply(importedStringClass); // --> returns true assignableTo(List.class).apply(importedStringClass); // --> returns false- Parameters:
type- An upper type bound to match imported classes against (imported subtypes will match)- Returns:
- A syntax element that can either be used as working rule, or to continue specifying a more complex rule
-
notBeAssignableTo
@PublicAPI(usage=ACCESS) ClassesShouldConjunction notBeAssignableTo(java.lang.Class<?> type)
Asserts that classes are not assignable to a certain type. This is the negation ofbeAssignableTo(Class).- Parameters:
type- An upper type bound imported classes should NOT have- Returns:
- A syntax element that can either be used as working rule, or to continue specifying a more complex rule
-
beAssignableTo
@PublicAPI(usage=ACCESS) ClassesShouldConjunction beAssignableTo(java.lang.String typeName)
Asserts that classes are assignable to a certain type with the given type name. This is equivalent tobeAssignableTo(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 element that can either be used as working rule, or to continue specifying a more complex rule
-
notBeAssignableTo
@PublicAPI(usage=ACCESS) ClassesShouldConjunction notBeAssignableTo(java.lang.String typeName)
Asserts that classes are not assignable to a certain type with the given type name. This is equivalent tonotBeAssignableTo(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 element that can either be used as working rule, or to continue specifying a more complex rule
-
beAssignableTo
@PublicAPI(usage=ACCESS) ClassesShouldConjunction beAssignableTo(DescribedPredicate<? super JavaClass> predicate)
Asserts that classes are assignable to a certain type matching the given predicate. For example, a call withHasName.Predicates.name(String)would be equivalent tobeAssignableTo(String), but the approach is a lot more generic.- Parameters:
predicate- A predicate identifying an upper type bound to match imported classes against (imported subtypes will match)- Returns:
- A syntax element that can either be used as working rule, or to continue specifying a more complex rule
-
notBeAssignableTo
@PublicAPI(usage=ACCESS) ClassesShouldConjunction notBeAssignableTo(DescribedPredicate<? super JavaClass> predicate)
Asserts that classes are not assignable to a certain type matching the given predicate. This is the negation ofbeAssignableTo(DescribedPredicate).- Parameters:
predicate- A predicate identifying an upper type bound imported classes should NOT have- Returns:
- A syntax element that can either be used as working rule, or to continue specifying a more complex rule
-
beAssignableFrom
@PublicAPI(usage=ACCESS) ClassesShouldConjunction beAssignableFrom(java.lang.Class<?> type)
Asserts that classes are 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).apply(importedArrayListClass); // --> returns true assignableFrom(ArrayList.class).apply(importedListClass); // --> returns true assignableFrom(ArrayList.class).apply(importedStringClass); // --> returns false- Parameters:
type- A lower type bound to match imported classes against (imported supertypes will match)- Returns:
- A syntax element that can either be used as working rule, or to continue specifying a more complex rule
-
notBeAssignableFrom
@PublicAPI(usage=ACCESS) ClassesShouldConjunction notBeAssignableFrom(java.lang.Class<?> type)
Asserts that classes are not assignable from a certain type. This is the negation ofbeAssignableFrom(Class).- Parameters:
type- A lower type bound imported classes should NOT have- Returns:
- A syntax element that can either be used as working rule, or to continue specifying a more complex rule
-
beAssignableFrom
@PublicAPI(usage=ACCESS) ClassesShouldConjunction beAssignableFrom(java.lang.String typeName)
Asserts that classes are assignable from a certain type with the given type name. This is equivalent tobeAssignableFrom(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 element that can either be used as working rule, or to continue specifying a more complex rule
-
notBeAssignableFrom
@PublicAPI(usage=ACCESS) ClassesShouldConjunction notBeAssignableFrom(java.lang.String typeName)
Asserts that classes are not assignable from a certain type with the given type name. This is equivalent tonotBeAssignableFrom(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 element that can either be used as working rule, or to continue specifying a more complex rule
-
beAssignableFrom
@PublicAPI(usage=ACCESS) ClassesShouldConjunction beAssignableFrom(DescribedPredicate<? super JavaClass> predicate)
Asserts that classes are assignable from a certain type matching the given predicate. For example, a call withHasName.Predicates.name(String)would be equivalent tobeAssignableFrom(String), but the approach is a lot more generic.- Parameters:
predicate- A predicate identifying a lower type bound to match imported classes against (imported supertypes will match)- Returns:
- A syntax element that can either be used as working rule, or to continue specifying a more complex rule
-
notBeAssignableFrom
@PublicAPI(usage=ACCESS) ClassesShouldConjunction notBeAssignableFrom(DescribedPredicate<? super JavaClass> predicate)
Asserts that classes are not assignable from a certain type matching the given predicate. This is the negation ofbeAssignableFrom(DescribedPredicate).- Parameters:
predicate- A predicate identifying a lower type bound imported classes should NOT have- Returns:
- A syntax element that can either be used as working rule, or to continue specifying a more complex rule
-
accessField
@PublicAPI(usage=ACCESS) ClassesShouldConjunction accessField(java.lang.Class<?> owner, java.lang.String fieldName)
Matches against all accesses (setting or getting) of a specific field.- Parameters:
owner- The class declaring the fieldfieldName- The name of the field to match- Returns:
- A syntax element that can either be used as working rule, or to continue specifying a more complex rule
-
accessField
@PublicAPI(usage=ACCESS) ClassesShouldConjunction accessField(java.lang.String ownerName, java.lang.String fieldName)
Matches against all accesses (setting or getting) of a specific field.- Parameters:
ownerName- The fully qualified class name of the class declaring the fieldfieldName- The name of the field to match- Returns:
- A syntax element that can either be used as working rule, or to continue specifying a more complex rule
-
accessFieldWhere
@PublicAPI(usage=ACCESS) ClassesShouldConjunction accessFieldWhere(DescribedPredicate<? super JavaFieldAccess> predicate)
Matches against accessing fields, where origin (a method or constructor) and target (a field) can be freely restricted by the supplied predicate.- Parameters:
predicate- Determines whichJavaFieldAccessesmatch the rule- Returns:
- A syntax element that can either be used as working rule, or to continue specifying a more complex rule
-
onlyAccessFieldsThat
@PublicAPI(usage=ACCESS) ClassesShouldConjunction onlyAccessFieldsThat(DescribedPredicate<? super JavaField> predicate)
Matches all field accesses against the supplied predicate.- Parameters:
predicate- Determines whichJavaFieldsmatch the rule- Returns:
- A syntax element that can either be used as working rule, or to continue specifying a more complex rule
-
getField
@PublicAPI(usage=ACCESS) ClassesShouldConjunction getField(java.lang.Class<?> owner, java.lang.String fieldName)
Matches against getting of a specific field (e.g.return someClass.someField;).- Parameters:
owner- The class declaring the fieldfieldName- The name of the field to match- Returns:
- A syntax element that can either be used as working rule, or to continue specifying a more complex rule
-
getField
@PublicAPI(usage=ACCESS) ClassesShouldConjunction getField(java.lang.String ownerName, java.lang.String fieldName)
Matches against getting a specific field (e.g.return someClass.someField;).- Parameters:
ownerName- The fully qualified class name of the class declaring the fieldfieldName- The name of the field to match- Returns:
- A syntax element that can either be used as working rule, or to continue specifying a more complex rule
-
getFieldWhere
@PublicAPI(usage=ACCESS) ClassesShouldConjunction getFieldWhere(DescribedPredicate<? super JavaFieldAccess> predicate)
Matches against getting of fields, where origin (a method or constructor) and target (a field) can be freely restricted by the supplied predicate.- Parameters:
predicate- Determines whichJavaFieldAccessesmatch the rule- Returns:
- A syntax element that can either be used as working rule, or to continue specifying a more complex rule
-
setField
@PublicAPI(usage=ACCESS) ClassesShouldConjunction setField(java.lang.Class<?> owner, java.lang.String fieldName)
Matches against setting a specific field (e.g.someClass.someField = newValue;).- Parameters:
owner- The class declaring the fieldfieldName- The name of the field to match- Returns:
- A syntax element that can either be used as working rule, or to continue specifying a more complex rule
-
setField
@PublicAPI(usage=ACCESS) ClassesShouldConjunction setField(java.lang.String ownerName, java.lang.String fieldName)
Matches against setting a specific field (e.g.someClass.someField = newValue;).- Parameters:
ownerName- The fully qualified class name of the class declaring the fieldfieldName- The name of the field to match- Returns:
- A syntax element that can either be used as working rule, or to continue specifying a more complex rule
-
setFieldWhere
@PublicAPI(usage=ACCESS) ClassesShouldConjunction setFieldWhere(DescribedPredicate<? super JavaFieldAccess> predicate)
Matches against setting of fields, where origin (a method or constructor) and target (a field) can be freely restricted by the supplied predicate.- Parameters:
predicate- Determines whichJavaFieldAccessesmatch the rule- Returns:
- A syntax element that can either be used as working rule, or to continue specifying a more complex rule
-
callMethod
@PublicAPI(usage=ACCESS) ClassesShouldConjunction callMethod(java.lang.Class<?> owner, java.lang.String methodName, java.lang.Class<?>... parameterTypes)
Matches against a method call to a specific method (e.g.someClass.call();).- Parameters:
owner- Class declaring the methodmethodName- The method name to match againstparameterTypes- The parameter types of the respective method- Returns:
- A syntax element that can either be used as working rule, or to continue specifying a more complex rule
-
callMethod
@PublicAPI(usage=ACCESS) ClassesShouldConjunction callMethod(java.lang.String ownerName, java.lang.String methodName, java.lang.String... parameterTypeNames)
Matches against method call to a specific method (e.g.someClass.call();).- Parameters:
ownerName- The fully qualified class name declaring the methodmethodName- The method name to match againstparameterTypeNames- The fully qualified parameter type names- Returns:
- A syntax element that can either be used as working rule, or to continue specifying a more complex rule
-
callMethodWhere
@PublicAPI(usage=ACCESS) ClassesShouldConjunction callMethodWhere(DescribedPredicate<? super JavaMethodCall> predicate)
Matches against method calls where origin (a method or constructor) and target (a method) can be freely restricted by the supplied predicate.- Parameters:
predicate- Determines whichJavaMethodCallsmatch the rule- Returns:
- A syntax element that can either be used as working rule, or to continue specifying a more complex rule
-
onlyCallMethodsThat
@PublicAPI(usage=ACCESS) ClassesShouldConjunction onlyCallMethodsThat(DescribedPredicate<? super JavaMethod> predicate)
Matches all method calls against the supplied predicate.- Parameters:
predicate- Determines whichJavaMethodsmatch the rule- Returns:
- A syntax element that can either be used as working rule, or to continue specifying a more complex rule
-
callConstructor
@PublicAPI(usage=ACCESS) ClassesShouldConjunction callConstructor(java.lang.Class<?> owner, java.lang.Class<?>... parameterTypes)
Matches against a constructor call to a specific constructor (e.g.new SomeClass();).- Parameters:
owner- Class declaring the constructorparameterTypes- The parameter types of the respective constructor- Returns:
- A syntax element that can either be used as working rule, or to continue specifying a more complex rule
-
callConstructor
@PublicAPI(usage=ACCESS) ClassesShouldConjunction callConstructor(java.lang.String ownerName, java.lang.String... parameterTypeNames)
Matches against constructor call to a specific constructor (e.g.new SomeClass();).- Parameters:
ownerName- The fully qualified class name declaring the constructorparameterTypeNames- The fully qualified parameter type names- Returns:
- A syntax element that can either be used as working rule, or to continue specifying a more complex rule
-
callConstructorWhere
@PublicAPI(usage=ACCESS) ClassesShouldConjunction callConstructorWhere(DescribedPredicate<? super JavaConstructorCall> predicate)
Matches against constructor calls where origin (a method or constructor) and target (a constructor) can be freely restricted by the supplied predicate.- Parameters:
predicate- Determines whichJavaConstructorCallsmatch the rule- Returns:
- A syntax element that can either be used as working rule, or to continue specifying a more complex rule
-
onlyCallConstructorsThat
@PublicAPI(usage=ACCESS) ClassesShouldConjunction onlyCallConstructorsThat(DescribedPredicate<? super JavaConstructor> predicate)
Matches all constructor calls against the supplied predicate.- Parameters:
predicate- Determines whichJavaConstructorsmatch the rule- Returns:
- A syntax element that can either be used as working rule, or to continue specifying a more complex rule
-
accessTargetWhere
@PublicAPI(usage=ACCESS) ClassesShouldConjunction accessTargetWhere(DescribedPredicate<? super JavaAccess<?>> predicate)
Matches against access of arbitrary targets (compareAccessTarget) where origin (a method or constructor) and target (a field, method or constructor) can be freely restricted by the supplied predicate.- Parameters:
predicate- Determines whichJavaAccessesmatch the rule- Returns:
- A syntax element that can either be used as working rule, or to continue specifying a more complex rule
-
onlyAccessMembersThat
@PublicAPI(usage=ACCESS) ClassesShouldConjunction onlyAccessMembersThat(DescribedPredicate<? super JavaMember> predicate)
Matches all members calls against the supplied predicate.- Parameters:
predicate- Determines whichJavaMembersmatch the rule- Returns:
- A syntax element that can either be used as working rule, or to continue specifying a more complex rule
-
callCodeUnitWhere
@PublicAPI(usage=ACCESS) ClassesShouldConjunction callCodeUnitWhere(DescribedPredicate<? super JavaCall<?>> predicate)
Matches against code unit calls (compareJavaCodeUnit) where origin (a code unit) and target (a code unit) can be freely restricted by the supplied predicate.- Parameters:
predicate- Determines whichJavaCallsmatch the rule- Returns:
- A syntax element that can either be used as working rule, or to continue specifying a more complex rule
-
onlyCallCodeUnitsThat
@PublicAPI(usage=ACCESS) ClassesShouldConjunction onlyCallCodeUnitsThat(DescribedPredicate<? super JavaCodeUnit> predicate)
Matches all code unit calls against the supplied predicate.- Parameters:
predicate- Determines whichJavaCodeUnitsmatch the rule- Returns:
- A syntax element that can either be used as working rule, or to continue specifying a more complex rule
-
accessClassesThat
@PublicAPI(usage=ACCESS) ClassesThat<ClassesShouldConjunction> accessClassesThat()
Asserts that all classes selected by this rule access certain classes (compareonlyAccessClassesThat()).
NOTE: This usually makes more sense the negated way, e.g.noClasses().should().accessClassesThat().haveFullyQualifiedName(String)- Returns:
- A syntax element that allows choosing which classes should be accessed
-
accessClassesThat
@PublicAPI(usage=ACCESS) ClassesShouldConjunction accessClassesThat(DescribedPredicate<? super JavaClass> predicate)
Asserts that all classes selected by this rule access certain classes (compareonlyAccessClassesThat(DescribedPredicate).
NOTE: This usually makes more sense the negated way, e.g.noClasses().should().accessClassesThat(myPredicate)- Parameters:
predicate- Determines whichJavaClassesmatch the access target- Returns:
- A syntax element that can either be used as working rule, or to continue specifying a more complex rule
-
onlyAccessClassesThat
@PublicAPI(usage=ACCESS) ClassesThat<ClassesShouldConjunction> onlyAccessClassesThat()
Asserts that all classes selected by this rule ONLY access certain classes (compareaccessClassesThat()).
E.g.classes().should().onlyAccessClassesThat().haveFullyQualifiedName(String)- Returns:
- A syntax element that allows choosing which classes should only be accessed
-
onlyAccessClassesThat
@PublicAPI(usage=ACCESS) ClassesShouldConjunction onlyAccessClassesThat(DescribedPredicate<? super JavaClass> predicate)
Asserts that all classes selected by this rule ONLY access certain classes (compareaccessClassesThat(DescribedPredicate)).
E.g.classes().should().onlyAccessClassesThat(myPredicate)- Parameters:
predicate- Determines whichJavaClassesmatch the access target- Returns:
- A syntax element that can either be used as working rule, or to continue specifying a more complex rule
-
dependOnClassesThat
@PublicAPI(usage=ACCESS) ClassesThat<ClassesShouldConjunction> dependOnClassesThat()
Asserts that all classes selected by this rule depend on certain classes.
NOTE: This usually makes more sense the negated way, e.g.noClasses().should().dependOnClassesThat().haveFullyQualifiedName(String)- Returns:
- A syntax element that allows choosing to which classes a dependency should exist
-
dependOnClassesThat
@PublicAPI(usage=ACCESS) ClassesShouldConjunction dependOnClassesThat(DescribedPredicate<? super JavaClass> predicate)
Asserts that all classes selected by this rule depend on certain classes.
NOTE: This usually makes more sense the negated way, e.g.noClasses().should().dependOnClassesThat(myPredicate)- Parameters:
predicate- Determines whichJavaClassesmatch the dependency target- Returns:
- A syntax element that can either be used as working rule, or to continue specifying a more complex rule
-
onlyDependOnClassesThat
@PublicAPI(usage=ACCESS) ClassesThat<ClassesShouldConjunction> onlyDependOnClassesThat()
Asserts that all classes selected by this rule ONLY depend on certain classes (comparedependOnClassesThat()).
E.g.classes().should().onlyDependOnClassesThat().haveFullyQualifiedName(String)- Returns:
- A syntax element that allows choosing to which classes a dependency should only exist
-
onlyDependOnClassesThat
@PublicAPI(usage=ACCESS) ClassesShouldConjunction onlyDependOnClassesThat(DescribedPredicate<? super JavaClass> predicate)
Asserts that all classes selected by this rule ONLY depend on certain classes (comparedependOnClassesThat(DescribedPredicate)).
E.g.classes().should().onlyDependOnClassesThat(myPredicate)- Parameters:
predicate- Determines whichJavaClassesmatch the dependency target- Returns:
- A syntax element that can either be used as working rule, or to continue specifying a more complex rule
-
onlyBeAccessed
@PublicAPI(usage=ACCESS) OnlyBeAccessedSpecification<ClassesShouldConjunction> onlyBeAccessed()
- Returns:
- A syntax element that allows restricting how classes should be accessed
E.g.onlyBeAccessed().byAnyPackage(String...)
-
onlyHaveDependentClassesThat
@PublicAPI(usage=ACCESS) ClassesThat<ClassesShouldConjunction> onlyHaveDependentClassesThat()
Asserts that only certain classes depend on the classes selected by this rule.
E.g.classes().should().onlyHaveDependentClassesThat().haveFullyQualifiedName(String)- Returns:
- A syntax element that allows choosing from which classes a dependency to these classes may exist
-
onlyHaveDependentClassesThat
@PublicAPI(usage=ACCESS) ClassesShouldConjunction onlyHaveDependentClassesThat(DescribedPredicate<? super JavaClass> predicate)
Asserts that only certain classes depend on the classes selected by this rule.
E.g.classes().should().onlyHaveDependentClassesThat(myPredicate)- Parameters:
predicate- Determines whichJavaClassesmatch the dependency origin- Returns:
- A syntax element that can either be used as working rule, or to continue specifying a more complex rule
-
beInterfaces
@PublicAPI(usage=ACCESS) ClassesShouldConjunction beInterfaces()
Asserts that classes are interfaces.- Returns:
- A syntax element that can either be used as working rule, or to continue specifying a more complex rule
-
notBeInterfaces
@PublicAPI(usage=ACCESS) ClassesShouldConjunction notBeInterfaces()
Asserts that classes are not interfaces.- Returns:
- A syntax element that can either be used as working rule, or to continue specifying a more complex rule
-
beEnums
@PublicAPI(usage=ACCESS) ClassesShouldConjunction beEnums()
Asserts that classes are enums.- Returns:
- A syntax element that can either be used as working rule, or to continue specifying a more complex rule
-
notBeEnums
@PublicAPI(usage=ACCESS) ClassesShouldConjunction notBeEnums()
Asserts that classes are not enums.- Returns:
- A syntax element that can either be used as working rule, or to continue specifying a more complex rule
-
be
@PublicAPI(usage=ACCESS) ClassesShouldConjunction be(java.lang.Class<?> clazz)
Asserts that the rule matches exactly the given class.- Parameters:
clazz- the only class the should be matched- Returns:
- A syntax element that can either be used as working rule, or to continue specifying a more complex rule
-
notBe
@PublicAPI(usage=ACCESS) ClassesShouldConjunction notBe(java.lang.Class<?> clazz)
Asserts that the rule does not match the given class.- Parameters:
clazz- the class that should not be matched- Returns:
- A syntax element that can either be used as working rule, or to continue specifying a more complex rule
-
be
@PublicAPI(usage=ACCESS) ClassesShouldConjunction be(java.lang.String className)
Asserts that the rule matches exactly the class with the given fully qualified class name.- Parameters:
className- the name of the only class that should be matched.- Returns:
- A syntax element that can either be used as working rule, or to continue specifying a more complex rule
-
notBe
@PublicAPI(usage=ACCESS) ClassesShouldConjunction notBe(java.lang.String className)
Asserts that the rule does not match the class with the given fully qualified class name.- Parameters:
className- the name of the class that should not be matched.- Returns:
- A syntax element that can either be used as working rule, or to continue specifying a more complex rule
-
containNumberOfElements
@PublicAPI(usage=ACCESS) ClassesShouldConjunction containNumberOfElements(DescribedPredicate<java.lang.Integer> predicate)
Asserts that the number of classes checked by this rule conforms to the supplied predicate.- Returns:
- A syntax element that can either be used as working rule, or to continue specifying a more complex rule
-
-