In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
Today, I would like to share with you the relevant knowledge of web adapter pattern structure. The content is detailed and the logic is clear. I believe most people still know too much about this, so share this article for your reference. I hope you can get something after reading this article. Let's take a look at it.
motivation
The above class diagram illustrates the object adapter instance. It shows how BoundingBox requests declared in the Shape class are transformed into GetExtent requests defined in the TextView class. Because TextShape matches the interface of TextView to that of Shape, the drawing editor can reuse previously incompatible TextView classes.
This is an example of using existing functionality in the adapter pattern. BoundingBox is a requirement on the side of the graphics editing software, and if you have similar functionality on both the library side, use it. Generally speaking, the parameters and the calling interface will be adjusted as needed. Using the functionality in the ready-to-use library is the purpose of using the adapter pattern.
Adapter is often responsible for providing functions that are not provided by matched classes, and the above class diagram shows how the adapter performs these responsibilities. Because the drawing editor allows users to interactively "drag" each Shape object to a new location, this feature is not available in TextView design. We can add this missing functionality by implementing the CreateManipulator operation of the TextShape class, which returns an instance of the corresponding Manipulator subclass.
Of course, there are also situations where some features are not supported in the existing library. At this point, it needs to be implemented in the adapter. Generally speaking, the part you implement should be relatively easy and have less work, otherwise the effect of using the adapter pattern will be reduced.
Manipulator is an abstract class that describes objects that know how to drive the Shape class to respond to corresponding user input, such as dragging the graph to a new location. Manipulator has different subclasses corresponding to graphics of different shapes; for example, the subclass TextManipulator corresponds to TextShape. TextShape adds functionality that is missing in TextView and required by Shape by returning an instance of TextManipulator.
Generating Manipulator instance is also the need of graphic editing software, the instance of adapter can generate its own Manipulator representation class, and this class can only use the function defined by graphic editing software, or can use the function of existing library.
These are all the contents of the article "what is the structure of the web Adapter pattern?" Thank you for reading! I believe you will gain a lot after reading this article. The editor will update different knowledge for you every day. If you want to learn more knowledge, please pay attention to the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.