diff --git a/docs/userguide/006_The_Core_API.adoc b/docs/userguide/006_The_Core_API.adoc index c5fdac403..43d41ac9a 100644 --- a/docs/userguide/006_The_Core_API.adoc +++ b/docs/userguide/006_The_Core_API.adoc @@ -89,45 +89,122 @@ like this: [plantuml, "domain-overview"] ---- -skinparam componentStyle uml2 - -skinparam component { - BorderColor #grey - BackgroundColor #white -} - -skinparam class { - BorderColor #grey - BackgroundColor #white -} - -class JavaPackage -class JavaClass -class JavaMember -class JavaField -class JavaCodeUnit -class ThrowsClause -class JavaConstructor -class JavaMethod -class JavaStaticInitializer - -class JavaFieldAccess -class JavaConstructorCall -class JavaMethodCall - -JavaPackage *--* "1..*" JavaClass : has -JavaClass *-- "0..*" JavaMember : has -JavaMember <|-- JavaField : extends -JavaMember <|-- JavaCodeUnit : extends -JavaCodeUnit <|-- JavaConstructor : extends -JavaCodeUnit <|-- JavaMethod : extends -JavaCodeUnit <|-- JavaStaticInitializer : extends -JavaConstructor *-- "1" ThrowsClause : has -JavaMethod *-- "1" ThrowsClause : has - -JavaCodeUnit *-- "0..*" JavaFieldAccess : has -JavaCodeUnit *-- "0..*" JavaMethodCall : has -JavaCodeUnit *-- "0..*" JavaConstructorCall : has +@startuml +skinparam hyperlinkUnderline false +hide empty members + +!function $getDomainLink($name, $prefix="") !return "[[https://javadoc.io/doc/com.tngtech.archunit/archunit/latest/com/tngtech/archunit/core/domain/" + $prefix + $name + ".html " + $name + "]]" +!function $getAccessTargetLink($name) !return $getDomainLink($name, "AccessTarget.") + +!unquoted procedure domainLink($name, $parameter="") + "$getDomainLink($name)$parameter " as $name +!endprocedure + +!unquoted procedure accessTargetLink($name) + "$getAccessTargetLink($name) " as $name +!endprocedure + +interface domainLink(JavaType) +interface domainLink(JavaParameterizedType) +class domainLink(JavaGenericArrayType) +class domainLink(JavaWildcardType) +class domainLink(JavaTypeVariable) + +class domainLink(JavaClasses)<>> + +class domainLink(JavaPackage) +class domainLink(JavaClass) +abstract class domainLink(JavaMember) + +class domainLink(JavaField) +abstract class domainLink(JavaCodeUnit) +class domainLink(JavaParameter) +class domainLink(JavaMethod) +class domainLink(JavaConstructor) +class domainLink(JavaStaticInitializer) + +class domainLink(JavaAnnotation, ) + +class domainLink(ThrowsClause, )<>> +class domainLink(ThrowsDeclaration) +class domainLink(ReferencedClassObject) +class domainLink(InstanceofCheck) +class domainLink(TryCatchBlock) +abstract class domainLink(JavaAccess, \n) +class domainLink(JavaFieldAccess) +abstract class domainLink(JavaCodeUnitAccess, \n) +abstract class domainLink(JavaCodeUnitReference, \n) +class domainLink(JavaMethodReference) +class domainLink(JavaConstructorReference) +abstract class domainLink(JavaCall, \n) +class domainLink(JavaMethodCall) +class domainLink(JavaConstructorCall) + +abstract class domainLink(AccessTarget) +class accessTargetLink(FieldAccessTarget) +abstract class accessTargetLink(CodeUnitAccessTarget) +abstract class accessTargetLink(CodeUnitReferenceTarget) +class accessTargetLink(MethodReferenceTarget) +class accessTargetLink(ConstructorReferenceTarget) +abstract class accessTargetLink(CodeUnitCallTarget) +class accessTargetLink(MethodCallTarget) +class accessTargetLink(ConstructorCallTarget) + +JavaClass ---u-|> JavaType +JavaParameterizedType --|> JavaType +JavaTypeVariable --|> JavaType +JavaGenericArrayType --|> JavaType +JavaWildcardType --|> JavaType + +JavaClasses -. JavaClass : contains > + +JavaPackage ||-{ "1..*" JavaClass : has > + +JavaParameter ||--{ "0..*" JavaAnnotation : has > +JavaPackage ||--{ "0..*" JavaAnnotation : has > +JavaClass ||--{ "0..*" JavaAnnotation : has > +JavaMember ||--{ "0..*" JavaAnnotation : has > + +JavaClass ||-{ "0..*" JavaMember : has > + +JavaMember <|-- JavaField +JavaMember <|--r- JavaCodeUnit + +JavaCodeUnit ||--{ "0..*" JavaParameter : has > +JavaCodeUnit <|-- JavaMethod +JavaCodeUnit <|--- JavaConstructor +JavaCodeUnit <|-- JavaStaticInitializer + +JavaCodeUnit ||--u{ "0..*" InstanceofCheck : has > +JavaCodeUnit ||--u{ "0..*" ReferencedClassObject : has > +JavaCodeUnit ||--u|| "1" ThrowsClause : has > +JavaCodeUnit ||--u{ "0..*" TryCatchBlock : has > +JavaCodeUnit ||--r-{ "0..*" JavaAccess : has > + +ThrowsClause ||-u-{ "0..*" ThrowsDeclaration : has > + +JavaAccess <|-- JavaFieldAccess : T =\n$getAccessTargetLink(FieldAccessTarget) +JavaAccess <|-- JavaCodeUnitAccess + +JavaCodeUnitAccess <|-- JavaCall +JavaCall <|-- JavaMethodCall : T =\n$getAccessTargetLink(MethodCallTarget) +JavaCall <|--- JavaConstructorCall : T=\n$getAccessTargetLink(ConstructorCallTarget) + +JavaCodeUnitAccess <|-- JavaCodeUnitReference +JavaCodeUnitReference <|-- JavaMethodReference : T=\n$getAccessTargetLink(MethodReferenceTarget) +JavaCodeUnitReference <|--- JavaConstructorReference : T=\n$getAccessTargetLink(ConstructorReferenceTarget) + +JavaAccess ||-r-|| "1" AccessTarget : has > +FieldAccessTarget -u-|> AccessTarget +FieldAccessTarget -[hidden]r-> CodeUnitAccessTarget +CodeUnitAccessTarget -u-|> AccessTarget +CodeUnitCallTarget -u-|> CodeUnitAccessTarget +MethodCallTarget -u-|> CodeUnitCallTarget +ConstructorCallTarget --u-|> CodeUnitCallTarget +CodeUnitReferenceTarget -u-|> CodeUnitAccessTarget +MethodReferenceTarget -u-|> CodeUnitReferenceTarget +ConstructorReferenceTarget --u-|> CodeUnitReferenceTarget +@enduml ---- Most objects resemble the Java Reflection API, including inheritance relations. Thus a `JavaClass`