Interface CodeUnitsThat<CONJUNCTION>
- All Superinterfaces:
MembersThat<CONJUNCTION>
- All Known Subinterfaces:
MethodsThat<CONJUNCTION>
@PublicAPI(usage=ACCESS)
public interface CodeUnitsThat<CONJUNCTION>
extends MembersThat<CONJUNCTION>
-
Method Summary
Modifier and TypeMethodDescriptiondeclareThrowableOfType(DescribedPredicate<? super JavaClass> predicate) MatchesJavaCodeUnitsthat declare aThrowablewhich matches the given predicate.declareThrowableOfType(Class<? extends Throwable> type) MatchesJavaCodeUnitsthat declare aThrowableof the specified type in their throws clause.declareThrowableOfType(String typeName) MatchesJavaCodeUnitsthat declare aThrowableof the specified fully qualified type name in their throws clause.doNotDeclareThrowableOfType(DescribedPredicate<? super JavaClass> predicate) MatchesJavaCodeUnitsthat do not declare aThrowablewhich matches the given predicate.doNotDeclareThrowableOfType(Class<? extends Throwable> type) MatchesJavaCodeUnitsthat do not declare aThrowableof the specified type in their throws clause.doNotDeclareThrowableOfType(String typeName) MatchesJavaCodeUnitsthat do not declare aThrowableof the specified fully qualified type name in their throws clause.doNotHaveRawParameterTypes(DescribedPredicate<? super List<JavaClass>> predicate) MatchesJavaCodeUnitsthat do not have raw parameter types matching the given predicate.doNotHaveRawParameterTypes(Class<?>... parameterTypes) MatchesJavaCodeUnitsthat do not have the specified raw parameter types.doNotHaveRawParameterTypes(String... parameterTypeNames) MatchesJavaCodeUnitsthat do not have the specified fully qualified raw parameter type names.doNotHaveRawReturnType(DescribedPredicate<? super JavaClass> predicate) MatchesJavaCodeUnitsthat do not have raw return types matching the given predicate.doNotHaveRawReturnType(Class<?> type) MatchesJavaCodeUnitsthat do not have the specified raw return types.doNotHaveRawReturnType(String typeName) MatchesJavaCodeUnitsthat do not have the specified fully qualified raw return type name.haveRawParameterTypes(DescribedPredicate<? super List<JavaClass>> predicate) MatchesJavaCodeUnitsthat have raw parameter types matching the given predicate.haveRawParameterTypes(Class<?>... parameterTypes) MatchesJavaCodeUnitsthat have the specified raw parameter types.haveRawParameterTypes(String... parameterTypeNames) MatchesJavaCodeUnitsthat have the specified fully qualified raw parameter type names.haveRawReturnType(DescribedPredicate<? super JavaClass> predicate) MatchesJavaCodeUnitsthat have raw return types matching the given predicate.haveRawReturnType(Class<?> type) MatchesJavaCodeUnitsthat have the specified raw return types.haveRawReturnType(String typeName) MatchesJavaCodeUnitsthat have the specified fully qualified raw return type name.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
-
haveRawParameterTypes
MatchesJavaCodeUnitsthat have the specified raw parameter types. Take for example
Thenclass Example { void someMethod(String stringParam, int intParam) {...} }someMethodwould be matched bycodeUnits().that().haveRawParameterTypes(String.class, int.class)- Parameters:
parameterTypes- Parameter types to matchJavaCodeUnitsagainst- Returns:
- A syntax conjunction element, which can be completed to form a full rule
-
doNotHaveRawParameterTypes
MatchesJavaCodeUnitsthat do not have the specified raw parameter types. Take for example
Thenclass Example { void someMethod(String stringParam, int intParam) {...} }someMethodwould be matched bycodeUnits().that().doNotHaveRawParameterTypes(String.class)- Parameters:
parameterTypes- Parameter types matchingJavaCodeUnitsmay not have- Returns:
- A syntax conjunction element, which can be completed to form a full rule
-
haveRawParameterTypes
MatchesJavaCodeUnitsthat have the specified fully qualified raw parameter type names. Take for example
Thenclass Example { void someMethod(String stringParam, int intParam) {...} }someMethodwould be matched bycodeUnits().that().haveRawParameterTypes(String.class.getName(), int.class.getName())- Parameters:
parameterTypeNames- Fully qualified names of parameter types to matchJavaCodeUnitsagainst- Returns:
- A syntax conjunction element, which can be completed to form a full rule
-
doNotHaveRawParameterTypes
MatchesJavaCodeUnitsthat do not have the specified fully qualified raw parameter type names. Take for example
Thenclass Example { void someMethod(String stringParam, int intParam) {...} }someMethodwould be matched bycodeUnits().that().doNotHaveRawParameterTypes(String.class.getName())- Parameters:
parameterTypeNames- Fully qualified names of parameter types matchingJavaCodeUnitsmay not have- Returns:
- A syntax conjunction element, which can be completed to form a full rule
-
haveRawParameterTypes
@PublicAPI(usage=ACCESS) CONJUNCTION haveRawParameterTypes(DescribedPredicate<? super List<JavaClass>> predicate) MatchesJavaCodeUnitsthat have raw parameter types matching the given predicate. Take for example
Thenclass Example { void someMethod(String stringParam, int intParam) {...} }someMethodwould be matched bycodeUnits().that().haveRawParameterTypes(whereFirstTypeIs(String.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- ADescribedPredicatethat determines, whichJavaCodeUnitsmatch by their raw parameter types- Returns:
- A syntax conjunction element, which can be completed to form a full rule
-
doNotHaveRawParameterTypes
@PublicAPI(usage=ACCESS) CONJUNCTION doNotHaveRawParameterTypes(DescribedPredicate<? super List<JavaClass>> predicate) MatchesJavaCodeUnitsthat do not have raw parameter types matching the given predicate. Take for example
Thenclass Example { void someMethod(String stringParam, int intParam) {...} }someMethodwould be matched bycodeUnits().that().doNotHaveRawParameterTypes(whereFirstTypeIs(int.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- ADescribedPredicatethat determines, whichJavaCodeUnitsdo not match by their raw parameter types- Returns:
- A syntax conjunction element, which can be completed to form a full rule
-
haveRawReturnType
MatchesJavaCodeUnitsthat have the specified raw return types. Take for example
Thenclass Example { String someMethod() {...} }someMethodwould be matched bycodeUnits().that().haveRawReturnType(String.class)- Parameters:
type- Return type to matchJavaCodeUnitsagainst- Returns:
- A syntax conjunction element, which can be completed to form a full rule
-
doNotHaveRawReturnType
MatchesJavaCodeUnitsthat do not have the specified raw return types. Take for example
Thenclass Example { String someMethod() {...} }someMethodwould be matched bycodeUnits().that().doNotHaveRawReturnType(Object.class)- Parameters:
type- Return type matchingJavaCodeUnitsmay not have- Returns:
- A syntax conjunction element, which can be completed to form a full rule
-
haveRawReturnType
MatchesJavaCodeUnitsthat have the specified fully qualified raw return type name. Take for example
Thenclass Example { String someMethod() {...} }someMethodwould be matched bycodeUnits().that().haveRawReturnType(String.class.getName())- Parameters:
typeName- Fully qualified name of a return type to matchJavaCodeUnitsagainst- Returns:
- A syntax conjunction element, which can be completed to form a full rule
-
doNotHaveRawReturnType
MatchesJavaCodeUnitsthat do not have the specified fully qualified raw return type name. Take for example
Thenclass Example { String someMethod() {...} }someMethodwould be matched bycodeUnits().that().doNotHaveRawReturnType(Object.class.getName())- Parameters:
typeName- Fully qualified name of a return type matchingJavaCodeUnitsmay not have- Returns:
- A syntax conjunction element, which can be completed to form a full rule
-
haveRawReturnType
@PublicAPI(usage=ACCESS) CONJUNCTION haveRawReturnType(DescribedPredicate<? super JavaClass> predicate) MatchesJavaCodeUnitsthat have raw return types matching the given predicate. Take for example
Thenclass Example { String someMethod() {...} }someMethodwould be matched bycodeUnits().that().haveRawReturnType(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- ADescribedPredicatethat determines, whichJavaCodeUnitsmatch by their raw return types- Returns:
- A syntax conjunction element, which can be completed to form a full rule
-
doNotHaveRawReturnType
@PublicAPI(usage=ACCESS) CONJUNCTION doNotHaveRawReturnType(DescribedPredicate<? super JavaClass> predicate) MatchesJavaCodeUnitsthat do not have raw return types matching the given predicate. Take for example
Thenclass Example { String someMethod() {...} }someMethodwould be matched bycodeUnits().that().doNotHaveRawReturnType(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- ADescribedPredicatethat determines, whichJavaCodeUnitsdo not match by their raw return types- Returns:
- A syntax conjunction element, which can be completed to form a full rule
-
declareThrowableOfType
MatchesJavaCodeUnitsthat declare aThrowableof the specified type in their throws clause. Take for example
Thenclass Example { void someMethod() throws FirstException, SecondException {...} }someMethodwould be matched bycodeUnits().that().declareThrowableOfType(FirstException.class)- Parameters:
type- Type of a declaredThrowableto matchJavaCodeUnitsagainst- Returns:
- A syntax conjunction element, which can be completed to form a full rule
-
doNotDeclareThrowableOfType
MatchesJavaCodeUnitsthat do not declare aThrowableof the specified type in their throws clause. Take for example
Thenclass Example { void someMethod() throws FirstException {...} }someMethodwould be matched bycodeUnits().that().doNotDeclareThrowableOfType(SecondException.class)- Parameters:
type- Type of a declaredThrowablematchingJavaCodeUnitsmay not have- Returns:
- A syntax conjunction element, which can be completed to form a full rule
-
declareThrowableOfType
MatchesJavaCodeUnitsthat declare aThrowableof the specified fully qualified type name in their throws clause. Take for example
Thenclass Example { void someMethod() throws FirstException, SecondException {...} }someMethodwould be matched bycodeUnits().that().declareThrowableOfType(FirstException.class.getName())- Parameters:
typeName- Fully qualified name of a type of a declaredThrowableto matchJavaCodeUnitsagainst- Returns:
- A syntax conjunction element, which can be completed to form a full rule
-
doNotDeclareThrowableOfType
MatchesJavaCodeUnitsthat do not declare aThrowableof the specified fully qualified type name in their throws clause. Take for example
Thenclass Example { void someMethod() throws FirstException {...} }someMethodwould be matched bycodeUnits().that().doNotDeclareThrowableOfType(SecondException.class.getName())- Parameters:
typeName- Fully qualified name of a type of a declaredThrowablematchingJavaCodeUnitsmay not have- Returns:
- A syntax conjunction element, which can be completed to form a full rule
-
declareThrowableOfType
@PublicAPI(usage=ACCESS) CONJUNCTION declareThrowableOfType(DescribedPredicate<? super JavaClass> predicate) MatchesJavaCodeUnitsthat declare aThrowablewhich matches the given predicate. Take for example
Thenclass Example { void someMethod() throws FirstException, SecondException {...} }someMethodwould be matched bycodeUnits().that().declareThrowableOfType(nameStartingWith("First"))
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- ADescribedPredicatethat determines, whichJavaCodeUnitsmatch by their declaredThrowable- Returns:
- A syntax conjunction element, which can be completed to form a full rule
-
doNotDeclareThrowableOfType
@PublicAPI(usage=ACCESS) CONJUNCTION doNotDeclareThrowableOfType(DescribedPredicate<? super JavaClass> predicate) MatchesJavaCodeUnitsthat do not declare aThrowablewhich matches the given predicate. Take for example
Thenclass Example { void someMethod() throws FirstException {...} }someMethodwould be matched bycodeUnits().that().doNotDeclareThrowableOfType(nameStartingWith("Second"))
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- ADescribedPredicatethat determines, whichJavaCodeUnitsdo not match by their declaredThrowable- Returns:
- A syntax conjunction element, which can be completed to form a full rule
-