-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathAdapterMain.java
More file actions
24 lines (18 loc) · 902 Bytes
/
AdapterMain.java
File metadata and controls
24 lines (18 loc) · 902 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package structural.adapter;
import structural.adapter.adapt.EmailServiceAdapter;
import structural.adapter.adapt.SMSServiceAdapter;
import structural.adapter.services.EmailService;
import structural.adapter.services.MessagingService;
import structural.adapter.services.SMSService;
import structural.adapter.services.impl.EmailServiceImpl;
import structural.adapter.services.impl.SMSServiceImpl;
public class AdapterMain {
public static void main(String[] args) {
SMSService smsService = new SMSServiceImpl();
EmailService emailService = new EmailServiceImpl();
MessagingService smsAdapter = new SMSServiceAdapter(smsService);
MessagingService emailAdapter = new EmailServiceAdapter(emailService);
smsAdapter.sendMessage("+1234567890", "Hello from SMS Adapter");
emailAdapter.sendMessage("user@example.com", "Hello from Email Adapter");
}
}