Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I want to apply the adapter design pattern. There is a system that delivers notifications to its users. The Notification interface is as below: public

I want to apply the adapter design pattern.

There is a system that delivers notifications to its users. The Notification interface is as below:

public interface Notification {

void setRecipient(User recipient);

void setSender(User sender);

void setMessage(String message);

String getMessage();

}

And the User interface looks like the following:

public interface User {

String getName();

String getMobileNumber();

Notification getPreferredContact();

}

This code was written to implement the Notification interface for in-system messages using a class InternalNotification. They would like to expand the system to SMS notifications and purchased code that will send SMS messages. That interface for an SMS message is :

public interface SmsMessage {

public void setSender(String phoneNumber);

public void setRecipient(String phoneNumber);

public void setMessageBody(byte[] data);

public byte[] getMessageBody();

}

I want to implement a class SmsToNotificationAdapter that lets the system use SMS messages to notify its users.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Concepts

Authors: David Kroenke, David Auer, Scott Vandenberg, Robert Yoder

9th Edition

0135188148, 978-0135188149, 9781642087611

More Books

Students also viewed these Databases questions