mirror of
https://github.com/tiennm99/java-design-patterns.git
synced 2026-05-22 04:25:35 +00:00
docs: update role object (#2961)
This commit is contained in:
@@ -24,21 +24,18 @@
|
||||
*/
|
||||
package com.iluwatar.roleobject;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
/**
|
||||
* Borrower role.
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
public class BorrowerRole extends CustomerRole {
|
||||
|
||||
private String name;
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String borrow() {
|
||||
return String.format("Borrower %s wants to get some money.", name);
|
||||
}
|
||||
|
||||
@@ -24,31 +24,20 @@
|
||||
*/
|
||||
package com.iluwatar.roleobject;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
/**
|
||||
* Investor role.
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
public class InvestorRole extends CustomerRole {
|
||||
|
||||
private String name;
|
||||
|
||||
private long amountToInvest;
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public long getAmountToInvest() {
|
||||
return amountToInvest;
|
||||
}
|
||||
|
||||
public void setAmountToInvest(long amountToInvest) {
|
||||
this.amountToInvest = amountToInvest;
|
||||
}
|
||||
|
||||
public String invest() {
|
||||
return String.format("Investor %s has invested %d dollars", name, amountToInvest);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user