Interface FieldsThat<CONJUNCTION>
- All Superinterfaces:
MembersThat<CONJUNCTION>
-
Method Summary
Modifier and TypeMethodDescriptionareFinal()Matches final fields.Matches non-final fields.Matches non-static fields.Matches static fields.doNotHaveRawType(DescribedPredicate<? super JavaClass> predicate) Matches fields where the raw type of those fields does not match the given predicate.doNotHaveRawType(Class<?> type) Matches fields that do not have the given raw type.doNotHaveRawType(String typeName) Matches fields that do not have the given fully qualified name of their raw type.haveRawType(DescribedPredicate<? super JavaClass> predicate) Matches fields where the raw type of those fields matches the given predicate.haveRawType(Class<?> type) Matches fields by their raw type.haveRawType(String typeName) Matches fields by the fully qualified name of their raw type.Methods inherited from interface com.tngtech.archunit.lang.syntax.elements.MembersThat
areAnnotatedWith, areAnnotatedWith, areAnnotatedWith, areDeclaredIn, areDeclaredIn, areDeclaredInClassesThat, areDeclaredInClassesThat, areMetaAnnotatedWith, areMetaAnnotatedWith, areMetaAnnotatedWith, areNotAnnotatedWith, areNotAnnotatedWith, areNotAnnotatedWith, areNotDeclaredIn, areNotDeclaredIn, areNotMetaAnnotatedWith, areNotMetaAnnotatedWith, areNotMetaAnnotatedWith, areNotPackagePrivate, areNotPrivate, areNotProtected, areNotPublic, arePackagePrivate, arePrivate, areProtected, arePublic, doNotHaveFullName, doNotHaveModifier, doNotHaveName, haveFullName, haveFullNameMatching, haveFullNameNotMatching, haveModifier, haveName, haveNameContaining, haveNameEndingWith, haveNameMatching, haveNameNotContaining, haveNameNotEndingWith, haveNameNotMatching, haveNameNotStartingWith, haveNameStartingWith
-
Method Details
-
haveRawType
Matches fields by their raw type. Take for example
Thenclass Example { String someField; }someFieldwould be matched byfields().that().haveRawType(String.class)- Parameters:
type- Type matching fields must have- Returns:
- A syntax conjunction element, which can be completed to form a full rule
-
doNotHaveRawType
Matches fields that do not have the given raw type. Take for example
Thenclass Example { String someField; }someFieldwould be matched byfields().that().doNotHaveRawType(Object.class)- Parameters:
type- Type matching fields must not have- Returns:
- A syntax conjunction element, which can be completed to form a full rule
-
haveRawType
Matches fields by the fully qualified name of their raw type. Take for example
Thenclass Example { String someField; }someFieldwould be matched byfields().that().haveRawType(String.class.getName())- Parameters:
typeName- Name of type matching fields must have- Returns:
- A syntax conjunction element, which can be completed to form a full rule
-
doNotHaveRawType
Matches fields that do not have the given fully qualified name of their raw type. Take for example
Thenclass Example { String someField; }someFieldwould be matched byfields().that().doNotHaveRawType(Object.class.getName())- Parameters:
typeName- Name of type matching fields must not have- Returns:
- A syntax conjunction element, which can be completed to form a full rule
-
haveRawType
Matches fields where the raw type of those fields matches the given predicate. Take for example
Thenclass Example { String someField; }someFieldwould be matched byfields().that().haveRawType(assignableTo(Serializable.class))
Note that many predefinedpredicatescan be found within a subclassPredicatesof the respective domain object or a common ancestor. For example,predicatestargetingJavaClasscan be found withinJavaClass.Predicatesor one of the respective ancestors likeHasName.Predicates.- Parameters:
predicate- A predicate determining which types of fields match- Returns:
- A syntax conjunction element, which can be completed to form a full rule
-
doNotHaveRawType
@PublicAPI(usage=ACCESS) CONJUNCTION doNotHaveRawType(DescribedPredicate<? super JavaClass> predicate) Matches fields where the raw type of those fields does not match the given predicate. Take for example
Thenclass Example { String someField; }someFieldwould be matched byfields().that().doNotHaveRawType(assignableTo(List.class))
Note that many predefinedpredicatescan be found within a subclassPredicatesof the respective domain object or a common ancestor. For example,predicatestargetingJavaClasscan be found withinJavaClass.Predicatesor one of the respective ancestors likeHasName.Predicates.- Parameters:
predicate- A predicate determining which types of fields do not match- Returns:
- A syntax conjunction element, which can be completed to form a full rule
-
areStatic
Matches static fields.- Returns:
- A syntax conjunction element, which can be completed to form a full rule
-
areNotStatic
Matches non-static fields.- Returns:
- A syntax conjunction element, which can be completed to form a full rule
-
areFinal
Matches final fields.- Returns:
- A syntax conjunction element, which can be completed to form a full rule
-
areNotFinal
Matches non-final fields.- Returns:
- A syntax conjunction element, which can be completed to form a full rule
-