Package com.tngtech.archunit.core.domain
Class JavaCodeUnit
- java.lang.Object
-
- com.tngtech.archunit.core.domain.JavaMember
-
- com.tngtech.archunit.core.domain.JavaCodeUnit
-
- All Implemented Interfaces:
HasDescription
,CanBeAnnotated
,HasAnnotations<JavaMember>
,HasDescriptor
,HasModifiers
,HasName
,HasName.AndFullName
,HasOwner<JavaClass>
,HasParameterTypes
,HasReturnType
,HasSourceCodeLocation
,HasThrowsClause<JavaCodeUnit>
- Direct Known Subclasses:
JavaConstructor
,JavaMethod
,JavaStaticInitializer
public abstract class JavaCodeUnit extends JavaMember implements HasParameterTypes, HasReturnType, HasThrowsClause<JavaCodeUnit>
Represents a unit of code containing accesses to other units of code. A unit of code can be- a method
- a constructor
- a static initializer
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
JavaCodeUnit.Functions
static class
JavaCodeUnit.Predicates
-
Nested classes/interfaces inherited from interface com.tngtech.archunit.core.domain.properties.CanBeAnnotated
CanBeAnnotated.Utils
-
Nested classes/interfaces inherited from interface com.tngtech.archunit.core.domain.properties.HasName
HasName.AndFullName
-
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description java.util.Set<JavaAccess<?>>
getAccessesFromSelf()
JavaAnnotation<? extends JavaCodeUnit>
getAnnotationOfType(java.lang.String typeName)
java.util.Set<? extends JavaAnnotation<? extends JavaCodeUnit>>
getAnnotations()
java.util.Set<JavaCall<?>>
getCallsFromSelf()
java.util.Set<JavaConstructorCall>
getConstructorCallsFromSelf()
JavaClassList
getExceptionTypes()
java.util.Set<JavaFieldAccess>
getFieldAccesses()
java.lang.String
getFullName()
java.util.Set<InstanceofCheck>
getInstanceofChecks()
java.util.Set<JavaMethodCall>
getMethodCallsFromSelf()
JavaClassList
getRawParameterTypes()
JavaClass
getRawReturnType()
abstract ThrowsClause<? extends JavaCodeUnit>
getThrowsClause()
boolean
isConstructor()
Optional<? extends JavaAnnotation<? extends JavaCodeUnit>>
tryGetAnnotationOfType(java.lang.String typeName)
-
Methods inherited from class com.tngtech.archunit.core.domain.JavaMember
getAccessesToSelf, getAnnotationOfType, getDescriptor, getModifiers, getName, getOwner, getReverseDependencies, getSourceCodeLocation, isAnnotatedWith, isAnnotatedWith, isAnnotatedWith, isMetaAnnotatedWith, isMetaAnnotatedWith, isMetaAnnotatedWith, reflect, toString, tryGetAnnotationOfType
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.tngtech.archunit.base.HasDescription
getDescription
-
-
-
-
Method Detail
-
getFullName
@PublicAPI(usage=ACCESS) public java.lang.String getFullName()
- Specified by:
getFullName
in interfaceHasName.AndFullName
- Returns:
- The full name of this
JavaCodeUnit
, i.e. a string containing${declaringClass}.${name}(${parameterTypes})
-
getRawParameterTypes
@PublicAPI(usage=ACCESS) public JavaClassList getRawParameterTypes()
- Specified by:
getRawParameterTypes
in interfaceHasParameterTypes
-
getThrowsClause
@PublicAPI(usage=ACCESS) public abstract ThrowsClause<? extends JavaCodeUnit> getThrowsClause()
- Specified by:
getThrowsClause
in interfaceHasThrowsClause<JavaCodeUnit>
-
getExceptionTypes
@PublicAPI(usage=ACCESS) public JavaClassList getExceptionTypes()
- Returns:
- The types thrown by this method, similar to
Method.getExceptionTypes()
-
getRawReturnType
@PublicAPI(usage=ACCESS) public JavaClass getRawReturnType()
- Specified by:
getRawReturnType
in interfaceHasReturnType
-
getFieldAccesses
@PublicAPI(usage=ACCESS) public java.util.Set<JavaFieldAccess> getFieldAccesses()
-
getMethodCallsFromSelf
@PublicAPI(usage=ACCESS) public java.util.Set<JavaMethodCall> getMethodCallsFromSelf()
-
getConstructorCallsFromSelf
@PublicAPI(usage=ACCESS) public java.util.Set<JavaConstructorCall> getConstructorCallsFromSelf()
-
getInstanceofChecks
@PublicAPI(usage=ACCESS) public java.util.Set<InstanceofCheck> getInstanceofChecks()
-
getCallsFromSelf
@PublicAPI(usage=ACCESS) public java.util.Set<JavaCall<?>> getCallsFromSelf()
-
getAccessesFromSelf
@PublicAPI(usage=ACCESS) public java.util.Set<JavaAccess<?>> getAccessesFromSelf()
-
isConstructor
@PublicAPI(usage=ACCESS) public boolean isConstructor()
-
getAnnotations
public java.util.Set<? extends JavaAnnotation<? extends JavaCodeUnit>> getAnnotations()
- Specified by:
getAnnotations
in interfaceHasAnnotations<JavaMember>
- Overrides:
getAnnotations
in classJavaMember
-
getAnnotationOfType
public JavaAnnotation<? extends JavaCodeUnit> getAnnotationOfType(java.lang.String typeName)
- Specified by:
getAnnotationOfType
in interfaceHasAnnotations<JavaMember>
- Overrides:
getAnnotationOfType
in classJavaMember
-
tryGetAnnotationOfType
public Optional<? extends JavaAnnotation<? extends JavaCodeUnit>> tryGetAnnotationOfType(java.lang.String typeName)
- Specified by:
tryGetAnnotationOfType
in interfaceHasAnnotations<JavaMember>
- Overrides:
tryGetAnnotationOfType
in classJavaMember
-
-