Thursday 14 September 2023

How to Connect Members of Two Classes in PlantUML

We can connect the fields of two classes using an arrow.

 

Example

Employee::addressId --> Address::id : foreign key

 

Above snippet connect the fields addressId of Employee class with the id field of Address class and label as ‘foreign key’.

 

connectMembers.txt

@startuml

class Employee{
	+int id
	+String name
	+int addressId
}

class Address{
	+int id
	+String country
	+String state
	+String city
	+int employeeId
}

Employee::addressId --> Address::id : foreign key
Address::employeeId --> Employee::id : foreign key

@enduml

 

Above snippet generate below diagram.


 

Previous                                                    Next                                                    Home

No comments:

Post a Comment