I want to write java code by an uml/class-diagram. But I'm not sure about it or how to write it for the relation 0..1 to 0..1
I didn't find any information about this relation.
1 to 0..1 is possible and I know how to create it. Here is my class diagram with relation 0..1 to 0..1:
I wrote this code for it.
public class IssueWithBankStuff {
Iban Iban;
Bic bic;
Customer customer;
Date contractIban;
IssueWithOtherStuff other;
public IssueWithBankStuff() {
}
public ContractForm getContractForm() {
return other.gethContractForm();
}
public void setContractForm(ContractForm contractForm) {
other.gethContractForm(contractForm);
}
public isHolding() {
return other.isHolding();
}
public void setHolding(Boolean hold) {
other.setHolding(hold);
}
public isGeneralCorperateForm() {
return other.isGeneralCorperateForm();
}
public void setHolding(Boolean generalCorperateForm) {
other.setGeneralCorperateForm(generalCorperateForm);
}
public getStartDate() {
return other.getStartDate();
}
public void setContractForm(Date startDate) {
other.setStartDate(startDate);
}
//class specific getters and setters
}
public IssueWithOtherStuff {
ContractForm contractForm;
Boolean holding;
Boolean generalCorperateForm
Date startDate;
IssueWithBankStuff iban;
public IssueWithOtherStuff () {
}
public void setIban(Iban ib) {
iban.setIban(ib);
}
public Iban getIban () {
return iban.getIban();
}
public void setBic(Bic bic) {
iban.setBic(bic);
}
public Bic getBic () {
return iban.getBic();
}
public void setCustomer(Customer customer) {
iban.setCustomer(customer);
}
public Customer getCustomer () {
return iban.getCustomer();
}
public void setContractIban(Date contractIban) {
iban.setContractIban(contractIban);
}
public Date getContractIban () {
return iban.getContractIban();
}
//getters and setters
}